[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nano-devel] [PATCH 04/10] drop various str fallback functions
From: |
Mike Frysinger |
Subject: |
[Nano-devel] [PATCH 04/10] drop various str fallback functions |
Date: |
Mon, 18 Apr 2016 02:17:39 -0400 |
These are provided by gnulib now.
---
configure.ac | 2 +-
src/chars.c | 65 ------------------------------------------------------------
src/nano.h | 12 -----------
src/proto.h | 12 -----------
4 files changed, 1 insertion(+), 90 deletions(-)
diff --git a/configure.ac b/configure.ac
index 57b1bb9..d0abbe5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -432,7 +432,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 00d942f..e7ee07a 100644
--- a/src/chars.c
+++ b/src/chars.c
@@ -510,38 +510,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, (size_t)-1);
-}
-#endif
-
/* This function is equivalent to strcasecmp() for multibyte strings. */
int mbstrcasecmp(const char *s1, const char *s2)
{
return mbstrncasecmp(s1, s2, (size_t)-1);
}
-#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;
-
- assert(s1 != NULL && s2 != NULL);
-
- 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)
@@ -594,30 +568,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 haystack_len, needle_len;
-
- assert(haystack != NULL && needle != NULL);
-
- if (*needle == '\0')
- return (char *)haystack;
-
- haystack_len = strlen(haystack);
- needle_len = strlen(needle);
-
- for (; *haystack != '\0' && haystack_len >= needle_len; haystack++,
- haystack_len--) {
- if (strncasecmp(haystack, needle, needle_len) == 0)
- return (char *)haystack;
- }
-
- return NULL;
-}
-#endif
-
/* This function is equivalent to strcasestr() for multibyte strings. */
char *mbstrcasestr(const char *haystack, const char *needle)
{
@@ -756,21 +706,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;
-
- assert(s != NULL);
-
- 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 7a9e008..7c26ca2 100644
--- a/src/nano.h
+++ b/src/nano.h
@@ -133,18 +133,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 44621a4..42dfa91 100644
--- a/src/proto.h
+++ b/src/proto.h
@@ -197,17 +197,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);
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
char *revstrstr(const char *haystack, const char *needle, const char
@@ -220,9 +211,6 @@ char *mbrevstrcasestr(const char *haystack, const char
*needle, const
char *rev_start);
#endif
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);
--
2.7.4
- Re: [Nano-devel] [PATCH 01/10] configure: require autoconf-2.69/automake-1.14, (continued)
[Nano-devel] [PATCH 05/10] drop getdelim/getline fallback functions, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 09/10] drop glib fallback for snprintf/vsnprintf, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 06/10] drop isblank/iswblank fallback functions, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 10/10] drop wchar.h/wctype.h/stdarg.h checks, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 08/10] assume getopt_long support is always available, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 04/10] drop various str fallback functions,
Mike Frysinger <=
[Nano-devel] [PATCH 03/10] add support for gnulib, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 02/10] gettext: update to 0.18.3 release, Mike Frysinger, 2016/04/18
[Nano-devel] [PATCH 07/10] assume regex.h support is always available, Mike Frysinger, 2016/04/18
Re: [Nano-devel] [PATCH 00/10] update autotools & add gnulib support, Kamil Dudka, 2016/04/18