commit 28133e934d5afde7088424f604a666b02d6a55cb
parent ba8d71f4478bff4d76bbc2f5fbda60ec1f7a7739
Author: Mike Frysinger <vapier@gentoo.org>
Date: Tue, 21 Feb 2017 17:04:36 -0500
drop various str fallback functions
These are provided by gnulib now.
Diffstat:
4 files changed, 1 insertion(+), 84 deletions(-)
diff --git 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
@@ -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
@@ -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
@@ -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);