summaryrefslogtreecommitdiff
path: root/lwlib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2012-07-06 14:07:46 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2012-07-06 14:07:46 -0700
commitfee5959dd8b389bc222618a35b042a92a1358c21 (patch)
tree936ae7da59bfa6d4c15f03929bbf6090190ea23a /lwlib
parentfd573f31dcaec9cd5170ba33af10d7c71c56822c (diff)
downloademacs-fee5959dd8b389bc222618a35b042a92a1358c21.tar.gz
Use c_strcasecmp for ASCII case-insensitive comparison.
Fixes: debbugs:11786
Diffstat (limited to 'lwlib')
-rw-r--r--lwlib/ChangeLog6
-rw-r--r--lwlib/lwlib.c28
2 files changed, 8 insertions, 26 deletions
diff --git a/lwlib/ChangeLog b/lwlib/ChangeLog
index 7f87c5d8e6a..ab1212441bb 100644
--- a/lwlib/ChangeLog
+++ b/lwlib/ChangeLog
@@ -1,3 +1,9 @@
+2012-07-06 Paul Eggert <eggert@cs.ucla.edu>
+
+ Use c_strcasecmp for ASCII case-insensitive comparison (Bug#11786).
+ * lwlib.c: Include c-strcase.h.
+ (lwlib_strcasecmp): Remove. All uses replaced with c_strcasecmp.
+
2012-06-26 Paul Eggert <eggert@cs.ucla.edu>
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. */
#include <setjmp.h>
#include <lisp.h>
+#include <c-strcase.h>
#include <sys/types.h>
#include <stdio.h>
@@ -112,31 +113,6 @@ 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
-lwlib_strcasecmp (const char *s1, const char *s2)
-{
- while (1)
- {
- int c1 = *s1++;
- int c2 = *s2++;
- if (isupper (c1))
- c1 = tolower (c1);
- if (isupper (c2))
- c2 = tolower (c2);
- if (c1 != c2)
- return (c1 > c2 ? 1 : -1);
- if (c1 == 0)
- return 0;
- }
-}
-#endif /* HAVE_STRCASECMP */
-
static void
safe_free_str (char *s)
{
@@ -733,7 +709,7 @@ find_in_table (const char *type, const widget_creation_entry *table)
{
const widget_creation_entry* cur;
for (cur = table; cur->type; cur++)
- if (!lwlib_strcasecmp (type, cur->type))
+ if (!c_strcasecmp (type, cur->type))
return cur->function;
return NULL;
}