diff src/strcmp.c @ 203:850242ba4a81 r20-3b28

Import from CVS: tag r20-3b28
author cvs
date Mon, 13 Aug 2007 10:02:21 +0200
parents 376386a54a3c
children 74fd4e045ea6
line wrap: on
line diff
--- a/src/strcmp.c	Mon Aug 13 10:01:24 2007 +0200
+++ b/src/strcmp.c	Mon Aug 13 10:02:21 2007 +0200
@@ -24,6 +24,11 @@
    Here are correct versions by hbs@lucid.com.
 */
 
+# include <config.h>
+# ifndef REGISTER	/* Strictly enforced in 20.3 */
+# define REGISTER
+# endif
+
 #include <string.h>
 #define ALIGNED(x) (!(((unsigned long) (x)) & (sizeof (unsigned long) - 1)))
 
@@ -31,6 +36,7 @@
 #define HIGH_BIT_P(c) ((c) & hi_bit)
 #define HAS_ZERO(c) (((((c) + magic) ^ (c)) & not_magic) != not_magic)
 
+/* CONST IS LOSING, but const is part of the interface of strcmp */
 int
 strcmp (const char *x, const char *y)
 {
@@ -38,8 +44,8 @@
     return 0;
   else if (ALIGNED (x) && ALIGNED (y))
     {
-      const unsigned long *x1 = (const unsigned long *) x;
-      const unsigned long *y1 = (const unsigned long *) y;
+      CONST unsigned long *x1 = (CONST unsigned long *) x;
+      CONST unsigned long *y1 = (CONST unsigned long *) y;
       unsigned long c;
       unsigned long magic = MAGIC;
       unsigned long not_magic = ~magic;
@@ -53,8 +59,8 @@
                 return 0;
               else
                 {
-                  x = (const char *) x1;
-                  y = (const char *) y1;
+                  x = (CONST char *) x1;
+                  y = (CONST char *) y1;
                   goto slow_loop;
                 }
             }
@@ -63,8 +69,8 @@
           y1++;
         }
 
-      x = (const char *) x1;
-      y = (const char *) y1;
+      x = (CONST char *) x1;
+      y = (CONST char *) y1;
       goto slow_loop;
     }
   else
@@ -85,14 +91,14 @@
 
 
 int
-strncmp (const char *x, const char *y, size_t n)
+strncmp (CONST char *x, CONST char *y, size_t n)
 {
   if ((x == y) || (n <= 0))
     return 0;
   else if (ALIGNED (x) && ALIGNED (y))
     {
-      const unsigned long *x1 = (const unsigned long *) x;
-      const unsigned long *y1 = (const unsigned long *) y;
+      CONST unsigned long *x1 = (CONST unsigned long *) x;
+      CONST unsigned long *y1 = (CONST unsigned long *) y;
       unsigned long c;
       unsigned long magic = MAGIC;
       unsigned long not_magic = ~magic;
@@ -110,8 +116,8 @@
                 return 0;
               else
                 {
-                  x = (const char *) x1;
-                  y = (const char *) y1;
+                  x = (CONST char *) x1;
+                  y = (CONST char *) y1;
                   goto slow_loop;
                 }
             }
@@ -120,8 +126,8 @@
           y1++;
         }
 
-      x = (const char *) x1;
-      y = (const char *) y1;
+      x = (CONST char *) x1;
+      y = (CONST char *) y1;
       goto slow_loop;
     }
   else