diff options
-rw-r--r-- | AuDispose.c | 3 | ||||
-rw-r--r-- | AuFileName.c | 8 | ||||
-rw-r--r-- | AuGetAddr.c | 6 | ||||
-rw-r--r-- | AuGetBest.c | 8 | ||||
-rw-r--r-- | AuRead.c | 17 | ||||
-rw-r--r-- | AuWrite.c | 4 | ||||
-rw-r--r-- | include/X11/Xauth.h | 4 |
7 files changed, 21 insertions, 29 deletions
diff --git a/AuDispose.c b/AuDispose.c index 58ffd61..cb6f85c 100644 --- a/AuDispose.c +++ b/AuDispose.c @@ -34,8 +34,7 @@ in this Software without prior written authorization from The Open Group. #include <stdlib.h> void -XauDisposeAuth (auth) -Xauth *auth; +XauDisposeAuth (Xauth *auth) { if (auth) { if (auth->address) (void) free (auth->address); diff --git a/AuFileName.c b/AuFileName.c index a51fc3b..b21b048 100644 --- a/AuFileName.c +++ b/AuFileName.c @@ -35,9 +35,9 @@ in this Software without prior written authorization from The Open Group. #include <stdlib.h> char * -XauFileName () +XauFileName (void) { - char *slashDotXauthority = "/.Xauthority"; + const char *slashDotXauthority = "/.Xauthority"; char *name; static char *buf; static int bsize; @@ -58,7 +58,7 @@ XauFileName () } if (!name) #endif - return 0; + return NULL; } size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; if (size > bsize) { @@ -66,7 +66,7 @@ XauFileName () free (buf); buf = malloc ((unsigned) size); if (!buf) - return 0; + return NULL; bsize = size; } strcpy (buf, name); diff --git a/AuGetAddr.c b/AuGetAddr.c index ab13cb6..6275531 100644 --- a/AuGetAddr.c +++ b/AuGetAddr.c @@ -71,12 +71,12 @@ _Xconst char* name) auth_name = XauFileName (); if (!auth_name) - return 0; + return NULL; if (access (auth_name, R_OK) != 0) /* checks REAL id */ - return 0; + return NULL; auth_file = fopen (auth_name, "rb"); if (!auth_file) - return 0; + return NULL; for (;;) { entry = XauReadAuth (auth_file); if (!entry) diff --git a/AuGetBest.c b/AuGetBest.c index 5ff1c7c..ae2b748 100644 --- a/AuGetBest.c +++ b/AuGetBest.c @@ -83,12 +83,12 @@ XauGetBestAuthByAddr ( auth_name = XauFileName (); if (!auth_name) - return 0; + return NULL; if (access (auth_name, R_OK) != 0) /* checks REAL id */ - return 0; + return NULL; auth_file = fopen (auth_name, "rb"); if (!auth_file) - return 0; + return NULL; #ifdef hpux if (family == FamilyLocal) { @@ -110,7 +110,7 @@ XauGetBestAuthByAddr ( } #endif /* hpux */ - best = 0; + best = NULL; best_type = types_length; for (;;) { entry = XauReadAuth (auth_file); @@ -53,7 +53,7 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) if (read_short (&len, file) == 0) return 0; if (len == 0) { - data = 0; + data = NULL; } else { data = malloc ((unsigned) len); if (!data) @@ -70,30 +70,29 @@ read_counted_string (unsigned short *countp, char **stringp, FILE *file) } Xauth * -XauReadAuth (auth_file) -FILE *auth_file; +XauReadAuth (FILE *auth_file) { Xauth local; Xauth *ret; if (read_short (&local.family, auth_file) == 0) - return 0; + return NULL; if (read_counted_string (&local.address_length, &local.address, auth_file) == 0) - return 0; + return NULL; if (read_counted_string (&local.number_length, &local.number, auth_file) == 0) { if (local.address) free (local.address); - return 0; + return NULL; } if (read_counted_string (&local.name_length, &local.name, auth_file) == 0) { if (local.address) free (local.address); if (local.number) free (local.number); - return 0; + return NULL; } if (read_counted_string (&local.data_length, &local.data, auth_file) == 0) { if (local.address) free (local.address); if (local.number) free (local.number); if (local.name) free (local.name); - return 0; + return NULL; } ret = (Xauth *) malloc (sizeof (Xauth)); if (!ret) { @@ -104,7 +103,7 @@ FILE *auth_file; bzero (local.data, local.data_length); free (local.data); } - return 0; + return NULL; } *ret = local; return ret; @@ -55,9 +55,7 @@ write_counted_string (unsigned short count, char *string, FILE *file) } int -XauWriteAuth (auth_file, auth) -FILE *auth_file; -Xauth *auth; +XauWriteAuth (FILE *auth_file, Xauth *auth) { if (write_short (auth->family, auth_file) == 0) return 0; diff --git a/include/X11/Xauth.h b/include/X11/Xauth.h index fa9c96b..181618a 100644 --- a/include/X11/Xauth.h +++ b/include/X11/Xauth.h @@ -81,10 +81,6 @@ FILE* /* auth_file */, Xauth* /* auth */ ); -Xauth *XauGetAuthByName( -_Xconst char* /* display_name */ -); - Xauth *XauGetAuthByAddr( #if NeedWidePrototypes unsigned int /* family */, |