aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2014-08-27 19:18:34 +0300
committerArnold D. Robbins <arnold@skeeve.com>2014-08-27 19:18:34 +0300
commitff28c07f95ff2400eb0ad1becc0eae1eab9dc93d (patch)
treec7be1aedb1c0dbd1cd1d78a7d0704a013a064855
parenta5847cb0a97b093cd0f23b65c72370af836c9748 (diff)
downloadegawk-ff28c07f95ff2400eb0ad1becc0eae1eab9dc93d.tar.gz
egawk-ff28c07f95ff2400eb0ad1becc0eae1eab9dc93d.tar.bz2
egawk-ff28c07f95ff2400eb0ad1becc0eae1eab9dc93d.zip
Cleanup code for strcasecmp.
-rw-r--r--ChangeLog7
-rw-r--r--configh.in3
-rwxr-xr-xconfigure2
-rw-r--r--configure.ac2
-rw-r--r--regcomp.c11
-rw-r--r--replace.c2
6 files changed, 13 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index d5336ea9..2759539b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2014-08-27 Arnold D. Robbins <arnold@skeeve.com>
+
+ * configure.ac: Add test for strcasecmp.
+ * regcomp.c: Remove special case code around use of strcasecmp().
+ * replace.c: Include missing/strncasecmp.c if either strcasecmp()
+ or strncasecmp() aren't available.
+
2014-08-26 Arnold D. Robbins <arnold@skeeve.com>
* regcomp.c, regex_internal.c: Sync with GBLIC. Why not.
diff --git a/configh.in b/configh.in
index bfffd853..90924526 100644
--- a/configh.in
+++ b/configh.in
@@ -195,6 +195,9 @@
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
+/* Define to 1 if you have the `strcasecmp' function. */
+#undef HAVE_STRCASECMP
+
/* Define to 1 if you have the `strchr' function. */
#undef HAVE_STRCHR
diff --git a/configure b/configure
index 0cd8ff22..b59d9355 100755
--- a/configure
+++ b/configure
@@ -10007,7 +10007,7 @@ for ac_func in atexit btowc fmod getgrent getgroups grantpt \
isascii iswctype iswlower iswupper mbrlen \
memcmp memcpy memcpy_ulong memmove memset \
memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \
- strerror strftime strncasecmp strcoll strtod strtoul \
+ strerror strftime strcasecmp strncasecmp strcoll strtod strtoul \
system tmpfile towlower towupper tzset usleep wcrtomb \
wcscoll wctype
do :
diff --git a/configure.ac b/configure.ac
index b0817ba3..5ad3b564 100644
--- a/configure.ac
+++ b/configure.ac
@@ -275,7 +275,7 @@ AC_CHECK_FUNCS(atexit btowc fmod getgrent getgroups grantpt \
isascii iswctype iswlower iswupper mbrlen \
memcmp memcpy memcpy_ulong memmove memset \
memset_ulong mkstemp posix_openpt setenv setlocale setsid snprintf strchr \
- strerror strftime strncasecmp strcoll strtod strtoul \
+ strerror strftime strcasecmp strncasecmp strcoll strtod strtoul \
system tmpfile towlower towupper tzset usleep wcrtomb \
wcscoll wctype)
dnl this check is for both mbrtowc and the mbstate_t type, which is good
diff --git a/regcomp.c b/regcomp.c
index 9774ae50..d394efa9 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -907,24 +907,13 @@ init_dfa (re_dfa_t *dfa, size_t pat_len)
codeset_name = strchr (codeset_name, '.') + 1;
# endif
- /* strcasecmp isn't a standard interface. brute force check */
-#ifndef GAWK
if (strcasecmp (codeset_name, "UTF-8") == 0
|| strcasecmp (codeset_name, "UTF8") == 0)
dfa->is_utf8 = 1;
-#else
- if ( (codeset_name[0] == 'U' || codeset_name[0] == 'u')
- && (codeset_name[1] == 'T' || codeset_name[1] == 't')
- && (codeset_name[2] == 'F' || codeset_name[2] == 'f')
- && (codeset_name[3] == '-'
- ? codeset_name[4] == '8' && codeset_name[5] == '\0'
- : codeset_name[3] == '8' && codeset_name[4] == '\0'))
- dfa->is_utf8 = 1;
#if defined(GAWK) && defined(LIBC_IS_BORKED)
if (gawk_mb_cur_max == 1)
dfa->is_utf8 = 0;
#endif /* defined(GAWK) && defined(LIBC_IS_BORKED) */
-#endif
/* We check exhaustively in the loop below if this charset is a
superset of ASCII. */
diff --git a/replace.c b/replace.c
index 559de014..71a8dc51 100644
--- a/replace.c
+++ b/replace.c
@@ -50,7 +50,7 @@
#include "missing_d/memmove.c"
#endif /* HAVE_MEMMOVE */
-#ifndef HAVE_STRNCASECMP
+#if !defined(HAVE_STRNCASECMP) || !defined(HAVE_STRCASECMP)
#include "missing_d/strncasecmp.c"
#endif /* HAVE_STRCASE */