diff --git a/configure.ac b/configure.ac index 9379450da9abd5314ed75c6b61f681c34b724fb6..4743a1f043c72998d6addc3823c2cdd4e31fdaa4 100644 --- a/configure.ac +++ b/configure.ac @@ -473,7 +473,7 @@ int main(void) dnl Checks for functions. -AC_CHECK_FUNCS(getdelim getline isblank strcasecmp strcasestr strncasecmp strnlen snprintf vsnprintf) +AC_CHECK_FUNCS(getdelim getline isblank snprintf vsnprintf) if test "x$enable_utf8" != xno; then AC_CHECK_FUNCS(iswalnum iswblank iswpunct iswspace nl_langinfo mblen mbstowcs mbtowc wctomb wcwidth) diff --git a/src/chars.c b/src/chars.c index a683177b0e5e602ab593686800f74f716483cf5c..add7a391854b8f7daf6a96af0c019870518b435d 100644 --- a/src/chars.c +++ b/src/chars.c @@ -450,36 +450,12 @@ size_t move_mbright(const char *buf, size_t pos) return pos + parse_mbchar(buf + pos, NULL, NULL); } -#ifndef HAVE_STRCASECMP -/* This function is equivalent to strcasecmp(). */ -int nstrcasecmp(const char *s1, const char *s2) -{ - return strncasecmp(s1, s2, HIGHEST_POSITIVE); -} -#endif - /* This function is equivalent to strcasecmp() for multibyte strings. */ int mbstrcasecmp(const char *s1, const char *s2) { return mbstrncasecmp(s1, s2, HIGHEST_POSITIVE); } -#ifndef HAVE_STRNCASECMP -/* This function is equivalent to strncasecmp(). */ -int nstrncasecmp(const char *s1, const char *s2, size_t n) -{ - if (s1 == s2) - return 0; - - for (; *s1 != '\0' && *s2 != '\0' && n > 0; s1++, s2++, n--) { - if (tolower(*s1) != tolower(*s2)) - break; - } - - return (n > 0) ? tolower(*s1) - tolower(*s2) : 0; -} -#endif - /* This function is equivalent to strncasecmp() for multibyte strings. */ int mbstrncasecmp(const char *s1, const char *s2, size_t n) { @@ -524,28 +500,6 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n) return strncasecmp(s1, s2, n); } -#ifndef HAVE_STRCASESTR -/* This function is equivalent to strcasestr(). */ -char *nstrcasestr(const char *haystack, const char *needle) -{ - size_t needle_len; - - if (*needle == '\0') - return (char *)haystack; - - needle_len = strlen(needle); - - while (*haystack != '\0') { - if (strncasecmp(haystack, needle, needle_len) == 0) - return (char *)haystack; - - haystack++; - } - - return NULL; -} -#endif - /* This function is equivalent to strcasestr() for multibyte strings. */ char *mbstrcasestr(const char *haystack, const char *needle) { @@ -665,19 +619,6 @@ size_t mbstrlen(const char *s) return mbstrnlen(s, (size_t)-1); } -#ifndef HAVE_STRNLEN -/* This function is equivalent to strnlen(). */ -size_t nstrnlen(const char *s, size_t maxlen) -{ - size_t n = 0; - - for (; *s != '\0' && maxlen > 0; s++, maxlen--, n++) - ; - - return n; -} -#endif - /* This function is equivalent to strnlen() for multibyte strings. */ size_t mbstrnlen(const char *s, size_t maxlen) { diff --git a/src/nano.h b/src/nano.h index 964f96d4994f47ff356e773cdd86bd42454a1474..2a3152965fec60c3b5f65e840afab5679baf72bd 100644 --- a/src/nano.h +++ b/src/nano.h @@ -137,18 +137,6 @@ #ifndef HAVE_ISWBLANK #define iswblank niswblank #endif -#ifndef HAVE_STRCASECMP -#define strcasecmp nstrcasecmp -#endif -#ifndef HAVE_STRNCASECMP -#define strncasecmp nstrncasecmp -#endif -#ifndef HAVE_STRCASESTR -#define strcasestr nstrcasestr -#endif -#ifndef HAVE_STRNLEN -#define strnlen nstrnlen -#endif #ifndef HAVE_GETDELIM #define getdelim ngetdelim #endif diff --git a/src/proto.h b/src/proto.h index 291f6c06f9c556d1f421f33dd1946ed32f90a016..302d818041dfa17d30ac0b89e30e0e50334da742 100644 --- a/src/proto.h +++ b/src/proto.h @@ -217,17 +217,8 @@ char *make_mbchar(long chr, int *chr_mb_len); int parse_mbchar(const char *buf, char *chr, size_t *col); size_t move_mbleft(const char *buf, size_t pos); size_t move_mbright(const char *buf, size_t pos); -#ifndef HAVE_STRCASECMP -int nstrcasecmp(const char *s1, const char *s2); -#endif int mbstrcasecmp(const char *s1, const char *s2); -#ifndef HAVE_STRNCASECMP -int nstrncasecmp(const char *s1, const char *s2, size_t n); -#endif int mbstrncasecmp(const char *s1, const char *s2, size_t n); -#ifndef HAVE_STRCASESTR -char *nstrcasestr(const char *haystack, const char *needle); -#endif char *mbstrcasestr(const char *haystack, const char *needle); char *revstrstr(const char *haystack, const char *needle, const char *pointer); @@ -236,9 +227,6 @@ char *revstrcasestr(const char *haystack, const char *needle, const char char *mbrevstrcasestr(const char *haystack, const char *needle, const char *rev_start); size_t mbstrlen(const char *s); -#ifndef HAVE_STRNLEN -size_t nstrnlen(const char *s, size_t maxlen); -#endif size_t mbstrnlen(const char *s, size_t maxlen); #if !defined(NANO_TINY) || !defined(DISABLE_JUSTIFY) char *mbstrchr(const char *s, const char *c);