diff options
Diffstat (limited to 'nx-X11/lib/src/AuGetBest.c')
-rw-r--r-- | nx-X11/lib/src/AuGetBest.c | 22 |
1 files changed, 7 insertions, 15 deletions
diff --git a/nx-X11/lib/src/AuGetBest.c b/nx-X11/lib/src/AuGetBest.c index 2518805cc..3e0231b13 100644 --- a/nx-X11/lib/src/AuGetBest.c +++ b/nx-X11/lib/src/AuGetBest.c @@ -1,4 +1,3 @@ - /* Copyright 1988, 1998 The Open Group @@ -34,14 +33,7 @@ in this Software without prior written authorization from The Open Group. #include <nx-X11/Xthreads.h> #endif -static int -binaryEqual (_Xconst char *a, _Xconst char *b, int len) -{ - while (len--) - if (*a++ != *b++) - return 0; - return 1; -} +#define binaryEqual(a, b, len) (memcmp(a, b, len) == 0) Xauth * XauGetBestAuthByAddr ( @@ -72,14 +64,14 @@ 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; - best = 0; + best = NULL; best_type = types_length; for (;;) { entry = XauReadAuth (auth_file); @@ -101,11 +93,11 @@ XauGetBestAuthByAddr ( if ((family == FamilyWild || entry->family == FamilyWild || (entry->family == family && ((address_length == entry->address_length && - binaryEqual (entry->address, address, (int)address_length)) + binaryEqual (entry->address, address, address_length)) ))) && (number_length == 0 || entry->number_length == 0 || (number_length == entry->number_length && - binaryEqual (entry->number, number, (int)number_length)))) + binaryEqual (entry->number, number, number_length)))) { if (best_type == 0) { |