diff options
| author | Paul Eggert | 2012-07-06 14:07:46 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-06 14:07:46 -0700 |
| commit | fee5959dd8b389bc222618a35b042a92a1358c21 (patch) | |
| tree | 936ae7da59bfa6d4c15f03929bbf6090190ea23a | |
| parent | fd573f31dcaec9cd5170ba33af10d7c71c56822c (diff) | |
| download | emacs-fee5959dd8b389bc222618a35b042a92a1358c21.tar.gz emacs-fee5959dd8b389bc222618a35b042a92a1358c21.zip | |
Use c_strcasecmp for ASCII case-insensitive comparison.
Fixes: debbugs:11786
| -rw-r--r-- | ChangeLog | 9 | ||||
| -rw-r--r-- | admin/ChangeLog | 5 | ||||
| -rwxr-xr-x | admin/merge-gnulib | 2 | ||||
| -rw-r--r-- | configure.in | 1 | ||||
| -rw-r--r-- | lib-src/ChangeLog | 7 | ||||
| -rw-r--r-- | lib-src/etags.c | 61 | ||||
| -rw-r--r-- | lib/gnulib.mk | 14 | ||||
| -rw-r--r-- | lwlib/ChangeLog | 6 | ||||
| -rw-r--r-- | lwlib/lwlib.c | 28 | ||||
| -rw-r--r-- | m4/gnulib-comp.m4 | 7 | ||||
| -rw-r--r-- | src/ChangeLog | 7 | ||||
| -rw-r--r-- | src/dispextern.h | 12 | ||||
| -rw-r--r-- | src/nsfns.m | 5 | ||||
| -rw-r--r-- | src/nsterm.m | 5 | ||||
| -rw-r--r-- | src/xfaces.c | 24 |
15 files changed, 73 insertions, 120 deletions
| @@ -1,5 +1,14 @@ | |||
| 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). | ||
| 4 | This is safer than strcasecmp, which has unspecified behavior | ||
| 5 | outside the POSIX locale and in practice sometimes does not work | ||
| 6 | in multibyte locales. Similarly for c_strncasecmp and strncasecmp. | ||
| 7 | * configure.in (strcasecmp, strncasecmp): Remove checks. | ||
| 8 | * lib/c-ctype.c, lib/c-ctype.h, lib/c-strcase.h, lib/c-strcasecmp.c: | ||
| 9 | * lib/c-strncasecmp.c: New files, taken from gnulib. | ||
| 10 | * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate. | ||
| 11 | |||
| 3 | Merge from gnulib, incorporating: | 12 | Merge from gnulib, incorporating: |
| 4 | 2012-07-06 timespec-sub: avoid duplicate include | 13 | 2012-07-06 timespec-sub: avoid duplicate include |
| 5 | Reported by Juanma Barranquero. | 14 | Reported by Juanma Barranquero. |
diff --git a/admin/ChangeLog b/admin/ChangeLog index 4563f2e6618..53b6143c82c 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). | ||
| 4 | * merge-gnulib (GNULIB_MODULES): Add c-strcase. | ||
| 5 | |||
| 1 | 2012-07-05 Dmitry Antipov <dmantipov@yandex.ru> | 6 | 2012-07-05 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 7 | ||
| 3 | * coccinelle/xzalloc.cocci: Semantic patch to convert | 8 | * coccinelle/xzalloc.cocci: Semantic patch to convert |
diff --git a/admin/merge-gnulib b/admin/merge-gnulib index d33807551d6..727b701cfe0 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib | |||
| @@ -26,7 +26,7 @@ | |||
| 26 | GNULIB_URL=git://git.savannah.gnu.org/gnulib.git | 26 | GNULIB_URL=git://git.savannah.gnu.org/gnulib.git |
| 27 | 27 | ||
| 28 | GNULIB_MODULES=' | 28 | GNULIB_MODULES=' |
| 29 | alloca-opt | 29 | alloca-opt c-strcase |
| 30 | careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 | 30 | careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 |
| 31 | dtoastr dtotimespec dup2 | 31 | dtoastr dtotimespec dup2 |
| 32 | filemode getloadavg getopt-gnu gettime gettimeofday | 32 | filemode getloadavg getopt-gnu gettime gettimeofday |
diff --git a/configure.in b/configure.in index dde8bcca855..1a43aed7540 100644 --- a/configure.in +++ b/configure.in | |||
| @@ -2707,7 +2707,6 @@ gai_strerror mkstemp getline getdelim fsync sync \ | |||
| 2707 | difftime posix_memalign \ | 2707 | difftime posix_memalign \ |
| 2708 | getpwent endpwent getgrent endgrent \ | 2708 | getpwent endpwent getgrent endgrent \ |
| 2709 | touchlock \ | 2709 | touchlock \ |
| 2710 | strcasecmp strncasecmp \ | ||
| 2711 | cfmakeraw cfsetspeed copysign __executable_start) | 2710 | cfmakeraw cfsetspeed copysign __executable_start) |
| 2712 | 2711 | ||
| 2713 | dnl Cannot use AC_CHECK_FUNCS | 2712 | dnl Cannot use AC_CHECK_FUNCS |
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 11f2a688cd2..56f1551e8ba 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog | |||
| @@ -1,3 +1,10 @@ | |||
| 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). | ||
| 4 | * etags.c: Include c-strcase.h. | ||
| 5 | (etags_strcasecmp, etags_strncasecmp): Remove. | ||
| 6 | All uses replaced with c_strcasecmp and c_strncasecmp. | ||
| 7 | |||
| 1 | 2012-07-06 Andreas Schwab <schwab@linux-m68k.org> | 8 | 2012-07-06 Andreas Schwab <schwab@linux-m68k.org> |
| 2 | 9 | ||
| 3 | * make-docfile.c (write_globals): Warn about duplicate function | 10 | * make-docfile.c (write_globals): Warn about duplicate function |
diff --git a/lib-src/etags.c b/lib-src/etags.c index 2e05e37e80f..5bdf3402e55 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c | |||
| @@ -144,6 +144,7 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 144 | #include <errno.h> | 144 | #include <errno.h> |
| 145 | #include <sys/types.h> | 145 | #include <sys/types.h> |
| 146 | #include <sys/stat.h> | 146 | #include <sys/stat.h> |
| 147 | #include <c-strcase.h> | ||
| 147 | 148 | ||
| 148 | #include <assert.h> | 149 | #include <assert.h> |
| 149 | #ifdef NDEBUG | 150 | #ifdef NDEBUG |
| @@ -174,9 +175,9 @@ char pot_etags_version[] = "@(#) pot revision number is 17.38.1.4"; | |||
| 174 | #endif | 175 | #endif |
| 175 | 176 | ||
| 176 | #define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t)) | 177 | #define streq(s,t) (assert ((s)!=NULL || (t)!=NULL), !strcmp (s, t)) |
| 177 | #define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !etags_strcasecmp (s, t)) | 178 | #define strcaseeq(s,t) (assert ((s)!=NULL && (t)!=NULL), !c_strcasecmp (s, t)) |
| 178 | #define strneq(s,t,n) (assert ((s)!=NULL || (t)!=NULL), !strncmp (s, t, n)) | 179 | #define strneq(s,t,n) (assert ((s)!=NULL || (t)!=NULL), !strncmp (s, t, n)) |
| 179 | #define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !etags_strncasecmp (s, t, n)) | 180 | #define strncaseeq(s,t,n) (assert ((s)!=NULL && (t)!=NULL), !c_strncasecmp (s, t, n)) |
| 180 | 181 | ||
| 181 | #define CHARS 256 /* 2^sizeof(char) */ | 182 | #define CHARS 256 /* 2^sizeof(char) */ |
| 182 | #define CHAR(x) ((unsigned int)(x) & (CHARS - 1)) | 183 | #define CHAR(x) ((unsigned int)(x) & (CHARS - 1)) |
| @@ -375,16 +376,6 @@ static char *savenstr (const char *, int); | |||
| 375 | static char *savestr (const char *); | 376 | static char *savestr (const char *); |
| 376 | static char *etags_strchr (const char *, int); | 377 | static char *etags_strchr (const char *, int); |
| 377 | static char *etags_strrchr (const char *, int); | 378 | static char *etags_strrchr (const char *, int); |
| 378 | #ifdef HAVE_STRCASECMP | ||
| 379 | #define etags_strcasecmp(x,y) strcasecmp ((x), (y)) | ||
| 380 | #else | ||
| 381 | static int etags_strcasecmp (const char *, const char *); | ||
| 382 | #endif | ||
| 383 | #ifdef HAVE_STRNCASECMP | ||
| 384 | #define etags_strncasecmp(x,y,z) strncasecmp ((x), (y), (z)) | ||
| 385 | #else | ||
| 386 | static int etags_strncasecmp (const char *, const char *, int); | ||
| 387 | #endif | ||
| 388 | static char *etags_getcwd (void); | 379 | static char *etags_getcwd (void); |
| 389 | static char *relative_filename (char *, char *); | 380 | static char *relative_filename (char *, char *); |
| 390 | static char *absolute_filename (char *, char *); | 381 | static char *absolute_filename (char *, char *); |
| @@ -6314,52 +6305,6 @@ etags_strchr (register const char *sp, register int c) | |||
| 6314 | return NULL; | 6305 | return NULL; |
| 6315 | } | 6306 | } |
| 6316 | 6307 | ||
| 6317 | #ifndef HAVE_STRCASECMP | ||
| 6318 | /* | ||
| 6319 | * Compare two strings, ignoring case for alphabetic characters. | ||
| 6320 | * | ||
| 6321 | * Same as BSD's strcasecmp, included for portability. | ||
| 6322 | */ | ||
| 6323 | static int | ||
| 6324 | etags_strcasecmp (register const char *s1, register const char *s2) | ||
| 6325 | { | ||
| 6326 | while (*s1 != '\0' | ||
| 6327 | && (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6328 | ? lowcase (*s1) == lowcase (*s2) | ||
| 6329 | : *s1 == *s2)) | ||
| 6330 | s1++, s2++; | ||
| 6331 | |||
| 6332 | return (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6333 | ? lowcase (*s1) - lowcase (*s2) | ||
| 6334 | : *s1 - *s2); | ||
| 6335 | } | ||
| 6336 | #endif /* HAVE_STRCASECMP */ | ||
| 6337 | |||
| 6338 | #ifndef HAVE_STRNCASECMP | ||
| 6339 | /* | ||
| 6340 | * Compare two strings, ignoring case for alphabetic characters. | ||
| 6341 | * Stop after a given number of characters | ||
| 6342 | * | ||
| 6343 | * Same as BSD's strncasecmp, included for portability. | ||
| 6344 | */ | ||
| 6345 | static int | ||
| 6346 | etags_strncasecmp (register const char *s1, register const char *s2, register int n) | ||
| 6347 | { | ||
| 6348 | while (*s1 != '\0' && n-- > 0 | ||
| 6349 | && (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6350 | ? lowcase (*s1) == lowcase (*s2) | ||
| 6351 | : *s1 == *s2)) | ||
| 6352 | s1++, s2++; | ||
| 6353 | |||
| 6354 | if (n < 0) | ||
| 6355 | return 0; | ||
| 6356 | else | ||
| 6357 | return (ISALPHA (*s1) && ISALPHA (*s2) | ||
| 6358 | ? lowcase (*s1) - lowcase (*s2) | ||
| 6359 | : *s1 - *s2); | ||
| 6360 | } | ||
| 6361 | #endif /* HAVE_STRCASECMP */ | ||
| 6362 | |||
| 6363 | /* Skip spaces (end of string is not space), return new pointer. */ | 6308 | /* Skip spaces (end of string is not space), return new pointer. */ |
| 6364 | static char * | 6309 | static char * |
| 6365 | skip_spaces (char *cp) | 6310 | skip_spaces (char *cp) |
diff --git a/lib/gnulib.mk b/lib/gnulib.mk index 20aa19d93a5..6e2bf89786c 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk | |||
| @@ -21,7 +21,7 @@ | |||
| 21 | # the same distribution terms as the rest of that program. | 21 | # the same distribution terms as the rest of that program. |
| 22 | # | 22 | # |
| 23 | # Generated by gnulib-tool. | 23 | # Generated by gnulib-tool. |
| 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings | 24 | # Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdarg stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings |
| 25 | 25 | ||
| 26 | 26 | ||
| 27 | MOSTLYCLEANFILES += core *.stackdump | 27 | MOSTLYCLEANFILES += core *.stackdump |
| @@ -64,6 +64,18 @@ EXTRA_DIST += allocator.h | |||
| 64 | 64 | ||
| 65 | ## end gnulib module allocator | 65 | ## end gnulib module allocator |
| 66 | 66 | ||
| 67 | ## begin gnulib module c-ctype | ||
| 68 | |||
| 69 | libgnu_a_SOURCES += c-ctype.h c-ctype.c | ||
| 70 | |||
| 71 | ## end gnulib module c-ctype | ||
| 72 | |||
| 73 | ## begin gnulib module c-strcase | ||
| 74 | |||
| 75 | libgnu_a_SOURCES += c-strcase.h c-strcasecmp.c c-strncasecmp.c | ||
| 76 | |||
| 77 | ## end gnulib module c-strcase | ||
| 78 | |||
| 67 | ## begin gnulib module careadlinkat | 79 | ## begin gnulib module careadlinkat |
| 68 | 80 | ||
| 69 | libgnu_a_SOURCES += careadlinkat.c | 81 | libgnu_a_SOURCES += careadlinkat.c |
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog index 7f87c5d8e6a..ab1212441bb 100644 --- a/lwlib/ChangeLog +++ b/lwlib/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> | ||
| 2 | |||
| 3 | Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). | ||
| 4 | * lwlib.c: Include c-strcase.h. | ||
| 5 | (lwlib_strcasecmp): Remove. All uses replaced with c_strcasecmp. | ||
| 6 | |||
| 1 | 2012-06-26 Paul Eggert <eggert@cs.ucla.edu> | 7 | 2012-06-26 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 8 | ||
| 3 | Clean out last vestiges of the old HAVE_CONFIG_H stuff. | 9 | Clean out last vestiges of the old HAVE_CONFIG_H stuff. |
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c index d436b18d222..5820be8d7a4 100644 --- a/lwlib/lwlib.c +++ b/lwlib/lwlib.c | |||
| @@ -24,6 +24,7 @@ Boston, MA 02110-1301, USA. */ | |||
| 24 | 24 | ||
| 25 | #include <setjmp.h> | 25 | #include <setjmp.h> |
| 26 | #include <lisp.h> | 26 | #include <lisp.h> |
| 27 | #include <c-strcase.h> | ||
| 27 | 28 | ||
| 28 | #include <sys/types.h> | 29 | #include <sys/types.h> |
| 29 | #include <stdio.h> | 30 | #include <stdio.h> |
| @@ -112,31 +113,6 @@ safe_strdup (const char *s) | |||
| 112 | return result; | 113 | return result; |
| 113 | } | 114 | } |
| 114 | 115 | ||
| 115 | #ifdef HAVE_STRCASECMP | ||
| 116 | #define lwlib_strcasecmp(x,y) strcasecmp ((x), (y)) | ||
| 117 | #else | ||
| 118 | |||
| 119 | /* Like strcmp but ignore differences in case. */ | ||
| 120 | |||
| 121 | static int | ||
| 122 | lwlib_strcasecmp (const char *s1, const char *s2) | ||
| 123 | { | ||
| 124 | while (1) | ||
| 125 | { | ||
| 126 | int c1 = *s1++; | ||
| 127 | int c2 = *s2++; | ||
| 128 | if (isupper (c1)) | ||
| 129 | c1 = tolower (c1); | ||
| 130 | if (isupper (c2)) | ||
| 131 | c2 = tolower (c2); | ||
| 132 | if (c1 != c2) | ||
| 133 | return (c1 > c2 ? 1 : -1); | ||
| 134 | if (c1 == 0) | ||
| 135 | return 0; | ||
| 136 | } | ||
| 137 | } | ||
| 138 | #endif /* HAVE_STRCASECMP */ | ||
| 139 | |||
| 140 | static void | 116 | static void |
| 141 | safe_free_str (char *s) | 117 | safe_free_str (char *s) |
| 142 | { | 118 | { |
| @@ -733,7 +709,7 @@ find_in_table (const char *type, const widget_creation_entry *table) | |||
| 733 | { | 709 | { |
| 734 | const widget_creation_entry* cur; | 710 | const widget_creation_entry* cur; |
| 735 | for (cur = table; cur->type; cur++) | 711 | for (cur = table; cur->type; cur++) |
| 736 | if (!lwlib_strcasecmp (type, cur->type)) | 712 | if (!c_strcasecmp (type, cur->type)) |
| 737 | return cur->function; | 713 | return cur->function; |
| 738 | return NULL; | 714 | return NULL; |
| 739 | } | 715 | } |
diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 17ece1cfe35..824c8bbffc8 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 | |||
| @@ -40,6 +40,8 @@ AC_DEFUN([gl_EARLY], | |||
| 40 | AC_REQUIRE([gl_PROG_AR_RANLIB]) | 40 | AC_REQUIRE([gl_PROG_AR_RANLIB]) |
| 41 | # Code from module alloca-opt: | 41 | # Code from module alloca-opt: |
| 42 | # Code from module allocator: | 42 | # Code from module allocator: |
| 43 | # Code from module c-ctype: | ||
| 44 | # Code from module c-strcase: | ||
| 43 | # Code from module careadlinkat: | 45 | # Code from module careadlinkat: |
| 44 | # Code from module clock-time: | 46 | # Code from module clock-time: |
| 45 | # Code from module crypto/md5: | 47 | # Code from module crypto/md5: |
| @@ -518,6 +520,11 @@ AC_DEFUN([gl_FILE_LIST], [ | |||
| 518 | lib/alloca.in.h | 520 | lib/alloca.in.h |
| 519 | lib/allocator.c | 521 | lib/allocator.c |
| 520 | lib/allocator.h | 522 | lib/allocator.h |
| 523 | lib/c-ctype.c | ||
| 524 | lib/c-ctype.h | ||
| 525 | lib/c-strcase.h | ||
| 526 | lib/c-strcasecmp.c | ||
| 527 | lib/c-strncasecmp.c | ||
| 521 | lib/careadlinkat.c | 528 | lib/careadlinkat.c |
| 522 | lib/careadlinkat.h | 529 | lib/careadlinkat.h |
| 523 | lib/dosname.h | 530 | lib/dosname.h |
diff --git a/src/ChangeLog b/src/ChangeLog index 96458770122..3f8cbdff476 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,5 +1,12 @@ | |||
| 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> | 1 | 2012-07-06 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 2 | ||
| 3 | Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786). | ||
| 4 | * dispextern.h, nsfns.m, nsterm.m: Include <c-strcase.h>. | ||
| 5 | * dispextern.h (xstrcasecmp): Rewrite using c_strcasecmp. | ||
| 6 | * nsfns.m (x_get_string_resource): Use c_strncasecmp, not strncasecmp. | ||
| 7 | * nsterm.m (ns_default): Use c_strcasecmp, not strcasecmp. | ||
| 8 | * xfaces.c (xstrcasecmp) [!HAVE_STRCASECMP]: Remove. | ||
| 9 | |||
| 3 | * xfont.c (compare_font_names): Redo to omit the need for casts. | 10 | * xfont.c (compare_font_names): Redo to omit the need for casts. |
| 4 | 11 | ||
| 5 | 2012-07-06 Andreas Schwab <schwab@linux-m68k.org> | 12 | 2012-07-06 Andreas Schwab <schwab@linux-m68k.org> |
diff --git a/src/dispextern.h b/src/dispextern.h index 4672d108e93..7d9f913e4f1 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -46,6 +46,13 @@ typedef struct { | |||
| 46 | #include "msdos.h" | 46 | #include "msdos.h" |
| 47 | #endif | 47 | #endif |
| 48 | 48 | ||
| 49 | #include <c-strcase.h> | ||
| 50 | static inline int | ||
| 51 | xstrcasecmp (char const *a, char const *b) | ||
| 52 | { | ||
| 53 | return c_strcasecmp (a, b); | ||
| 54 | } | ||
| 55 | |||
| 49 | #ifdef HAVE_X_WINDOWS | 56 | #ifdef HAVE_X_WINDOWS |
| 50 | typedef struct x_display_info Display_Info; | 57 | typedef struct x_display_info Display_Info; |
| 51 | typedef XImage * XImagePtr; | 58 | typedef XImage * XImagePtr; |
| @@ -3198,11 +3205,6 @@ void unload_color (struct frame *, unsigned long); | |||
| 3198 | char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, | 3205 | char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object, |
| 3199 | int *); | 3206 | int *); |
| 3200 | void prepare_face_for_display (struct frame *, struct face *); | 3207 | void prepare_face_for_display (struct frame *, struct face *); |
| 3201 | #ifdef HAVE_STRCASECMP | ||
| 3202 | #define xstrcasecmp(x,y) strcasecmp ((x), (y)) | ||
| 3203 | #else | ||
| 3204 | int xstrcasecmp (const char *, const char *); | ||
| 3205 | #endif | ||
| 3206 | int lookup_named_face (struct frame *, Lisp_Object, int); | 3208 | int lookup_named_face (struct frame *, Lisp_Object, int); |
| 3207 | int lookup_basic_face (struct frame *, int); | 3209 | int lookup_basic_face (struct frame *, int); |
| 3208 | int smaller_face (struct frame *, int, int); | 3210 | int smaller_face (struct frame *, int, int); |
diff --git a/src/nsfns.m b/src/nsfns.m index 5303a5ec313..47943e5d98a 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -33,6 +33,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 33 | #include <signal.h> | 33 | #include <signal.h> |
| 34 | #include <math.h> | 34 | #include <math.h> |
| 35 | #include <setjmp.h> | 35 | #include <setjmp.h> |
| 36 | #include <c-strcase.h> | ||
| 36 | 37 | ||
| 37 | #include "lisp.h" | 38 | #include "lisp.h" |
| 38 | #include "blockinput.h" | 39 | #include "blockinput.h" |
| @@ -2226,8 +2227,8 @@ x_get_string_resource (XrmDatabase rdb, char *name, char *class) | |||
| 2226 | 2227 | ||
| 2227 | res = ns_get_defaults_value (toCheck); | 2228 | res = ns_get_defaults_value (toCheck); |
| 2228 | return !res ? NULL : | 2229 | return !res ? NULL : |
| 2229 | (!strncasecmp (res, "YES", 3) ? "true" : | 2230 | (!c_strncasecmp (res, "YES", 3) ? "true" : |
| 2230 | (!strncasecmp (res, "NO", 2) ? "false" : res)); | 2231 | (!c_strncasecmp (res, "NO", 2) ? "false" : res)); |
| 2231 | } | 2232 | } |
| 2232 | 2233 | ||
| 2233 | 2234 | ||
diff --git a/src/nsterm.m b/src/nsterm.m index ae536638c33..1cd4c1c4271 100644 --- a/src/nsterm.m +++ b/src/nsterm.m | |||
| @@ -36,6 +36,7 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) | |||
| 36 | #include <signal.h> | 36 | #include <signal.h> |
| 37 | #include <unistd.h> | 37 | #include <unistd.h> |
| 38 | #include <setjmp.h> | 38 | #include <setjmp.h> |
| 39 | #include <c-strcase.h> | ||
| 39 | 40 | ||
| 40 | #include "lisp.h" | 41 | #include "lisp.h" |
| 41 | #include "blockinput.h" | 42 | #include "blockinput.h" |
| @@ -3848,9 +3849,9 @@ ns_default (const char *parameter, Lisp_Object *result, | |||
| 3848 | { | 3849 | { |
| 3849 | double f; | 3850 | double f; |
| 3850 | char *pos; | 3851 | char *pos; |
| 3851 | if (strcasecmp (value, "YES") == 0) | 3852 | if (c_strcasecmp (value, "YES") == 0) |
| 3852 | *result = yesval; | 3853 | *result = yesval; |
| 3853 | else if (strcasecmp (value, "NO") == 0) | 3854 | else if (c_strcasecmp (value, "NO") == 0) |
| 3854 | *result = noval; | 3855 | *result = noval; |
| 3855 | else if (is_float && (f = strtod (value, &pos), pos != value)) | 3856 | else if (is_float && (f = strtod (value, &pos), pos != value)) |
| 3856 | *result = make_float (f); | 3857 | *result = make_float (f); |
diff --git a/src/xfaces.c b/src/xfaces.c index a1062a44232..bc42cb4312a 100644 --- a/src/xfaces.c +++ b/src/xfaces.c | |||
| @@ -715,30 +715,6 @@ x_free_gc (struct frame *f, GC gc) | |||
| 715 | } | 715 | } |
| 716 | #endif /* HAVE_NS */ | 716 | #endif /* HAVE_NS */ |
| 717 | 717 | ||
| 718 | #ifndef HAVE_STRCASECMP | ||
| 719 | /* Like strcasecmp/stricmp. Used to compare parts of font names which | ||
| 720 | are in ISO8859-1. */ | ||
| 721 | |||
| 722 | int | ||
| 723 | xstrcasecmp (const char *s1, const char *s2) | ||
| 724 | { | ||
| 725 | while (*s1 && *s2) | ||
| 726 | { | ||
| 727 | unsigned char b1 = *s1; | ||
| 728 | unsigned char b2 = *s2; | ||
| 729 | unsigned char c1 = tolower (b1); | ||
| 730 | unsigned char c2 = tolower (b2); | ||
| 731 | if (c1 != c2) | ||
| 732 | return c1 < c2 ? -1 : 1; | ||
| 733 | ++s1, ++s2; | ||
| 734 | } | ||
| 735 | |||
| 736 | if (*s1 == 0) | ||
| 737 | return *s2 == 0 ? 0 : -1; | ||
| 738 | return 1; | ||
| 739 | } | ||
| 740 | #endif /* HAVE_STRCASECMP */ | ||
| 741 | |||
| 742 | /* If FRAME is nil, return a pointer to the selected frame. | 718 | /* If FRAME is nil, return a pointer to the selected frame. |
| 743 | Otherwise, check that FRAME is a live frame, and return a pointer | 719 | Otherwise, check that FRAME is a live frame, and return a pointer |
| 744 | to it. NPARAM is the parameter number of FRAME, for | 720 | to it. NPARAM is the parameter number of FRAME, for |