From: David Lawrence Ramsey Date: Sun, 20 Mar 2005 07:24:49 +0000 (+0000) Subject: put the old #defined aliases for strcasecmp(), strncasecmp(), X-Git-Tag: v1.3.6~2 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=adc30a839b9686bfbcd26d7d85ca3e5fb596fa30;p=nano.git put the old #defined aliases for strcasecmp(), strncasecmp(), strcasestr(), and strnlen() back with the #defined aliases for getline() and getdelim(), as they make things simpler git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@2401 35c25a1d-7b9e-4130-9fde-d3aeb78583b8 --- diff --git a/src/chars.c b/src/chars.c index 8080b775..c3e05ca2 100644 --- a/src/chars.c +++ b/src/chars.c @@ -483,12 +483,7 @@ size_t move_mbright(const char *buf, size_t pos) /* This function is equivalent to strcasecmp(). */ int nstrcasecmp(const char *s1, const char *s2) { - return -#ifdef HAVE_STRNCASECMP - strncasecmp(s1, s2, (size_t)-1); -#else - nstrncasecmp(s1, s2, (size_t)-1); -#endif + return strncasecmp(s1, s2, (size_t)-1); } #endif @@ -559,12 +554,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n) return (towlower(ws1) - towlower(ws2)); } else #endif - return -#ifdef HAVE_STRNCASECMP - strncasecmp(s1, s2, n); -#else - nstrncasecmp(s1, s2, n); -#endif + return strncasecmp(s1, s2, n); } #ifndef HAVE_STRCASESTR @@ -640,12 +630,7 @@ const char *mbstrcasestr(const char *haystack, const char *needle) return found_needle ? haystack : NULL; } else #endif - return -#ifdef HAVE_STRCASESTR - strcasestr(haystack, needle); -#else - nstrcasestr(haystack, needle); -#endif + return strcasestr(haystack, needle); } #if !defined(NANO_SMALL) || !defined(DISABLE_TABCOMP) @@ -802,12 +787,7 @@ size_t mbstrnlen(const char *s, size_t maxlen) return n; } else #endif - return -#ifdef HAVE_STRNLEN - strnlen(s, maxlen); -#else - nstrnlen(s, maxlen); -#endif + return strnlen(s, maxlen); } #ifndef DISABLE_JUSTIFY diff --git a/src/nano.h b/src/nano.h index c3c80d6f..f6ed4313 100644 --- a/src/nano.h +++ b/src/nano.h @@ -100,7 +100,20 @@ #endif #endif -/* If no getdelim() or getline(), use the versions we have. */ +/* If no strcasecmp(), strncasecmp(), strcasestr(), strnlen(), + * getdelim(), or getline(), use the versions we have. */ +#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