]> code.delx.au - gnu-emacs/commitdiff
* configure.in (AC_CHECK_FUNCS): Detect library functions
authorDmitry Antipov <dmantipov@yandex.ru>
Mon, 25 Jun 2012 14:07:04 +0000 (18:07 +0400)
committerDmitry Antipov <dmantipov@yandex.ru>
Mon, 25 Jun 2012 14:07:04 +0000 (18:07 +0400)
strcasecmp and strncasecmp.
* lib-src/etags.c (etags_strcasecmp, etags_strncasecmp): Define to
library functions strcasecmp and strncasecmp if available.
* lwlib/lwlib.c (my_strcasecmp): Rename to lwlib_strcasecmp, which
may be defined to library function strcasecmp if available.
* src/dispextern.c (xstrcasecmp): Define to library function
strcasecmp if available.
* src/xfaces.c: Do not use xstrcasecmp if strcasecmp is available.

ChangeLog
configure.in
lib-src/ChangeLog
lib-src/etags.c
lwlib/ChangeLog
lwlib/lwlib.c
src/ChangeLog
src/dispextern.h
src/xfaces.c

index 667634cd1bd7671a89151e864b951a51ee1405e9..ecbfaa502a7096199127a4a5d0a226b581aa35b8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * configure.in (AC_CHECK_FUNCS): Detect library functions
+       strcasecmp and strncasecmp.
+
 2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
 
        Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
index 1115486b2ef5e67f66c26fadce6411805f76b0ba..d85a64aa749ccfa02754d6e2154594044f4478b7 100644 (file)
@@ -2671,6 +2671,7 @@ gai_strerror mkstemp getline getdelim fsync sync \
 difftime posix_memalign \
 getpwent endpwent getgrent endgrent \
 touchlock \
+strcasecmp strncasecmp \
 cfmakeraw cfsetspeed copysign __executable_start)
 
 dnl Cannot use AC_CHECK_FUNCS
index a573cd88d10a501777945bd08d66cd5e1080747d..a04fe215f99bf6cdfdb1aee594c0ebbe4647427c 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * etags.c (etags_strcasecmp, etags_strncasecmp): Define to
+       library functions strcasecmp and strncasecmp if available.
+
 2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
 
        Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
index 71f153163efbf94569c1b6e266b3b203daadd950..f44c1c05393a2501cbf326afd11eece4dd06099c 100644 (file)
@@ -389,8 +389,16 @@ static char *savenstr (const char *, int);
 static char *savestr (const char *);
 static char *etags_strchr (const char *, int);
 static char *etags_strrchr (const char *, int);
+#ifdef HAVE_STRCASECMP
+#define etags_strcasecmp(x,y) strcasecmp ((x), (y))
+#else
 static int etags_strcasecmp (const char *, const char *);
+#endif
+#ifdef HAVE_STRNCASECMP
+#define etags_strncasecmp(x,y,z) strncasecmp ((x), (y), (z))
+#else
 static int etags_strncasecmp (const char *, const char *, int);
+#endif
 static char *etags_getcwd (void);
 static char *relative_filename (char *, char *);
 static char *absolute_filename (char *, char *);
@@ -6320,6 +6328,7 @@ etags_strchr (register const char *sp, register int c)
   return NULL;
 }
 
+#ifndef HAVE_STRCASECMP
 /*
  * Compare two strings, ignoring case for alphabetic characters.
  *
@@ -6338,7 +6347,9 @@ etags_strcasecmp (register const char *s1, register const char *s2)
          ? lowcase (*s1) - lowcase (*s2)
          : *s1 - *s2);
 }
+#endif /* HAVE_STRCASECMP */
 
+#ifndef HAVE_STRNCASECMP
 /*
  * Compare two strings, ignoring case for alphabetic characters.
  * Stop after a given number of characters
@@ -6361,6 +6372,7 @@ etags_strncasecmp (register const char *s1, register const char *s2, register in
            ? lowcase (*s1) - lowcase (*s2)
            : *s1 - *s2);
 }
+#endif /* HAVE_STRCASECMP */
 
 /* Skip spaces (end of string is not space), return new pointer. */
 static char *
index a6445f3ed563980446e81a5f8cb328551743e8d3..13b4b3bb3515ab0db7ec7bc4ae07fed6483ae7b5 100644 (file)
@@ -1,3 +1,8 @@
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * lwlib.c (my_strcasecmp): Rename to lwlib_strcasecmp, which
+       may be defined to library function strcasecmp if available.
+
 2012-06-24  Paul Eggert  <eggert@cs.ucla.edu>
 
        Switch from NO_RETURN to C11's _Noreturn (Bug#11750).
index 49c1b8df2e6753b0ffb4ba3e9a7d4e79b653b4ec..d1686ecd048b0657bcc8b50280409e2af9dda36b 100644 (file)
@@ -75,7 +75,6 @@ static widget_value *merge_widget_value (widget_value *,
                                          widget_value *,
                                          int, int *);
 static void instantiate_widget_instance (widget_instance *);
-static int my_strcasecmp (const char *, const char *);
 static void safe_free_str (char *);
 static void free_widget_value_tree (widget_value *);
 static widget_value *copy_widget_value_tree (widget_value *,
@@ -115,10 +114,14 @@ safe_strdup (const char *s)
   return result;
 }
 
+#ifdef HAVE_STRCASECMP
+#define lwlib_strcasecmp(x,y) strcasecmp ((x), (y))
+#else
+
 /* Like strcmp but ignore differences in case.  */
 
 static int
-my_strcasecmp (const char *s1, const char *s2)
+lwlib_strcasecmp (const char *s1, const char *s2)
 {
   while (1)
     {
@@ -134,6 +137,7 @@ my_strcasecmp (const char *s1, const char *s2)
        return 0;
     }
 }
+#endif /* HAVE_STRCASECMP */
 
 static void
 safe_free_str (char *s)
@@ -731,7 +735,7 @@ find_in_table (const char *type, const widget_creation_entry *table)
 {
   const widget_creation_entry* cur;
   for (cur = table; cur->type; cur++)
-    if (!my_strcasecmp (type, cur->type))
+    if (!lwlib_strcasecmp (type, cur->type))
       return cur->function;
   return NULL;
 }
index 48eb04ca50df33f687a030d9cb72c247dae5a117..a8c8b84b34aa49e8c912a2be41d77b94955853e4 100644 (file)
@@ -1,3 +1,9 @@
+2012-06-25  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       * dispextern.c (xstrcasecmp): Define to library function
+       strcasecmp if available.
+       * xfaces.c: Do not use xstrcasecmp if strcasecmp is available.
+
 2012-06-25  Andreas Schwab  <schwab@linux-m68k.org>
 
        * keyboard.c (menu_bar_items, menu_bar_item, read_key_sequence):
index 63c23b8962fdf45a21ef83b225c822953fee404b..d541d181fbf33390d3627e6e646d8e27a8528a76 100644 (file)
@@ -3216,7 +3216,11 @@ void unload_color (struct frame *, unsigned long);
 char *choose_face_font (struct frame *, Lisp_Object *, Lisp_Object,
                         int *);
 void prepare_face_for_display (struct frame *, struct face *);
+#ifdef HAVE_STRCASECMP
+#define xstrcasecmp(x,y) strcasecmp ((x), (y))
+#else
 int xstrcasecmp (const char *, const char *);
+#endif
 int lookup_named_face (struct frame *, Lisp_Object, int);
 int lookup_basic_face (struct frame *, int);
 int smaller_face (struct frame *, int, int);
index 32d1499b85aa5f8388dd8636076f1cb9dcc9d8a3..f2cd0eb6af8017612016b5689638c70b0aecafb6 100644 (file)
@@ -716,6 +716,7 @@ x_free_gc (struct frame *f, GC gc)
 }
 #endif  /* HAVE_NS */
 
+#ifndef HAVE_STRCASECMP
 /* Like strcasecmp/stricmp.  Used to compare parts of font names which
    are in ISO8859-1.  */
 
@@ -737,7 +738,7 @@ xstrcasecmp (const char *s1, const char *s2)
     return *s2 == 0 ? 0 : -1;
   return 1;
 }
-
+#endif /* HAVE_STRCASECMP */
 
 /* If FRAME is nil, return a pointer to the selected frame.
    Otherwise, check that FRAME is a live frame, and return a pointer