aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib/src/AuGetBest.c
diff options
context:
space:
mode:
authorUlrich Sibiller <uli42@gmx.de>2019-10-04 21:13:35 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-11-01 16:19:54 +0100
commitc590c64726db5c1a50640332c1383a471c24459d (patch)
tree90d2ee1bbbd5903ac7d6e9a2c908a7c410e1f09d /nx-X11/lib/src/AuGetBest.c
parent5929dfdebf9c9914187f1b41f70d0b721def7122 (diff)
downloadnx-libs-c590c64726db5c1a50640332c1383a471c24459d.tar.gz
nx-libs-c590c64726db5c1a50640332c1383a471c24459d.tar.bz2
nx-libs-c590c64726db5c1a50640332c1383a471c24459d.zip
Xau files: adapt code to match upstream libXau 1.0.9
Diffstat (limited to 'nx-X11/lib/src/AuGetBest.c')
-rw-r--r--nx-X11/lib/src/AuGetBest.c22
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)
{