summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-06-25 18:07:04 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-06-25 18:07:04 +0400
commit3511c7847949ea1d53a32cf9327c0e02d2191f3d (patch)
tree9370b7a199654a28179375c254220a304e7bc530 /lwlib
parentfb7da12e7560ce31fc88f829cff94723c3bbc5fa (diff)
downloademacs-3511c7847949ea1d53a32cf9327c0e02d2191f3d.tar.gz
* configure.in (AC_CHECK_FUNCS): Detect library functions
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.
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/ChangeLog5
-rw-r--r--lwlib/lwlib.c10
2 files changed, 12 insertions, 3 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index a6445f3ed56..13b4b3bb351 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -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).
diff --git a/lwlib/lwlib.c b/lwlib/lwlib.c
index 49c1b8df2e6..d1686ecd048 100644
--- a/lwlib/lwlib.c
+++ b/lwlib/lwlib.c
@@ -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;
}