From 070eb30ca675029e79f93333b60287527efc0906 Mon Sep 17 00:00:00 2001 From: bde Date: Sat, 31 Aug 1996 16:52:44 +0000 Subject: Fixed the easy cases of const poisoning in the kernel. Cosmetic. --- lib/libc/string/strcmp.c | 2 +- lib/libc/string/strncmp.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) (limited to 'lib/libc') diff --git a/lib/libc/string/strcmp.c b/lib/libc/string/strcmp.c index 79cfaa8..cf25e50 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 805b5b0..4b701a9 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); -- cgit v1.1