fix bcmp error
authorJohn Kohl <jtkohl@mit.edu>
Tue, 11 Sep 1990 16:13:33 +0000 (16:13 +0000)
committerJohn Kohl <jtkohl@mit.edu>
Tue, 11 Sep 1990 16:13:33 +0000 (16:13 +0000)
add register to args

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@1119 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/krb5/krb/faddr_ordr.c

index 323791bfb6c9bbd6683b05cfd69f561bf1631f4b..00843b01d53a71e5eeb1f428648a0d0da1e82c0d 100644 (file)
@@ -29,10 +29,13 @@ static char rcsid_faddr_ordr_c[] =
  */
 int
 krb5_fulladdr_order(addr1, addr2)
-const krb5_fulladdr *addr1;
-const krb5_fulladdr *addr2;
+register const krb5_fulladdr *addr1;
+register const krb5_fulladdr *addr2;
 {
     int dir;
+    const int minlen = min(addr1->address->length, addr2->address->length);
+    register int i;
+
     dir = addr1->address->addrtype - addr2->address->addrtype;
     if (dir)
        return(dir);
@@ -41,12 +44,14 @@ const krb5_fulladdr *addr2;
     if (dir)
        return(dir);
 
-    dir = bcmp((char *)addr1->address->contents,
-              (char *)addr2->address->contents,
-              min(addr1->address->length, addr2->address->length));
-    if (dir)
-       return(dir);
-
+    for (i = 0; i < minlen; i++) {
+       if ((unsigned char) addr1->address->contents[i] <
+           (unsigned char) addr2->address->contents[i])
+           return -1;
+       else if ((unsigned char) addr1->address->contents[i] >
+                (unsigned char) addr2->address->contents[i])
+           return 1;
+    }
     if (addr1->port > addr2->port)
        return(1);
     else if (addr1->port < addr2->port)