summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1996-08-31 16:52:44 +0000
committerBruce Evans <bde@FreeBSD.org>1996-08-31 16:52:44 +0000
commite0c95ed947b6e682a4a4e3571fb4d3150f7e0d67 (patch)
treed0ca99d3f53a0fe4ea60e83d05baa8825fdd8cc4 /lib/libc
parentb316c8b2a70e468e809fea8adcc54332fcec954d (diff)
Notes
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/string/strcmp.c2
-rw-r--r--lib/libc/string/strncmp.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/lib/libc/string/strcmp.c b/lib/libc/string/strcmp.c
index 79cfaa831b29..cf25e504b2d8 100644
--- a/lib/libc/string/strcmp.c
+++ b/lib/libc/string/strcmp.c
@@ -51,5 +51,5 @@ strcmp(s1, s2)
while (*s1 == *s2++)
if (*s1++ == 0)
return (0);
- return (*(unsigned char *)s1 - *(unsigned char *)--s2);
+ return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1));
}
diff --git a/lib/libc/string/strncmp.c b/lib/libc/string/strncmp.c
index 805b5b029688..4b701a9a385d 100644
--- a/lib/libc/string/strncmp.c
+++ b/lib/libc/string/strncmp.c
@@ -48,7 +48,8 @@ strncmp(s1, s2, n)
return (0);
do {
if (*s1 != *s2++)
- return (*(unsigned char *)s1 - *(unsigned char *)--s2);
+ return (*(const unsigned char *)s1 -
+ *(const unsigned char *)(s2 - 1));
if (*s1++ == 0)
break;
} while (--n != 0);