diff options
Diffstat (limited to 'lib/libc/strcmp.c')
-rw-r--r-- | lib/libc/strcmp.c | 26 |
1 files changed, 6 insertions, 20 deletions
diff --git a/lib/libc/strcmp.c b/lib/libc/strcmp.c index bb86e0f2..b742f9b9 100644 --- a/lib/libc/strcmp.c +++ b/lib/libc/strcmp.c @@ -1,4 +1,6 @@ /*- + * SPDX-License-Identifier: BSD-3-Clause + * * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * @@ -13,7 +15,7 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 4. Neither the name of the University nor the names of its contributors + * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * @@ -31,12 +33,10 @@ */ /* - * Portions copyright (c) 2014, ARM Limited and Contributors. + * Portions copyright (c) 2018, ARM Limited and Contributors. * All rights reserved. */ -#include <sys/cdefs.h> -#include <sys/ctype.h> #include <string.h> /* @@ -47,20 +47,6 @@ strcmp(const char *s1, const char *s2) { while (*s1 == *s2++) if (*s1++ == '\0') - return 0; - return *(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1); -} - -int -strcasecmp(const char *s1, const char *s2) -{ - const unsigned char *us1 = (const unsigned char *)s1; - const unsigned char *us2 = (const unsigned char *)s2; - - while (tolower(*us1) == tolower(*us2)) { - if (*us1++ == '\0') - return 0; - us2++; - } - return tolower(*us1) - tolower(*us2); + return (0); + return (*(const unsigned char *)s1 - *(const unsigned char *)(s2 - 1)); } |