* Boston, MA 02110-1301, USA. */
/* This function is equivalent to strcasestr(). */
-const char *nstrcasestr(const char *haystack, const char *needle)
+char *nstrcasestr(const char *haystack, const char *needle)
{
assert(haystack != NULL && needle != NULL);
if (needle == '\0')
- return haystack;
+ return (char *)haystack;
for (; *haystack != '\0'; haystack++) {
const char *r = haystack, *q = needle;
;
if (*q == '\0')
- return haystack;
+ return (char *)haystack;
}
return NULL;
#endif
/* This function is equivalent to strcasestr() for multibyte strings. */
-const char *mbstrcasestr(const char *haystack, const char *needle)
+char *mbstrcasestr(const char *haystack, const char *needle)
{
#ifdef ENABLE_UTF8
if (use_utf8) {
assert(haystack != NULL && needle != NULL);
if (needle == '\0')
- return haystack;
+ return (char *)haystack;
r_mb = charalloc(MB_CUR_MAX);
q_mb = charalloc(MB_CUR_MAX);
free(r_mb);
free(q_mb);
- return found_needle ? haystack : NULL;
+ return found_needle ? (char *)haystack : NULL;
} else
#endif
return strcasestr(haystack, needle);
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
/* This function is equivalent to strstr(), except in that it scans the
* string in reverse, starting at rev_start. */
-const char *revstrstr(const char *haystack, const char *needle, const
- char *rev_start)
+char *revstrstr(const char *haystack, const char *needle, const char
+ *rev_start)
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
if (needle == '\0')
- return rev_start;
+ return (char *)rev_start;
for (; rev_start >= haystack; rev_start--) {
const char *r = rev_start, *q = needle;
;
if (*q == '\0')
- return rev_start;
+ return (char *)rev_start;
}
return NULL;
#ifndef NANO_TINY
/* This function is equivalent to strcasestr(), except in that it scans
* the string in reverse, starting at rev_start. */
-const char *revstrcasestr(const char *haystack, const char *needle,
- const char *rev_start)
+char *revstrcasestr(const char *haystack, const char *needle, const char
+ *rev_start)
{
assert(haystack != NULL && needle != NULL && rev_start != NULL);
if (needle == '\0')
- return rev_start;
+ return (char *)rev_start;
for (; rev_start >= haystack; rev_start--) {
const char *r = rev_start, *q = needle;
;
if (*q == '\0')
- return rev_start;
+ return (char *)rev_start;
}
return NULL;
/* This function is equivalent to strcasestr() for multibyte strings,
* except in that it scans the string in reverse, starting at
* rev_start. */
-const char *mbrevstrcasestr(const char *haystack, const char *needle,
- const char *rev_start)
+char *mbrevstrcasestr(const char *haystack, const char *needle, const
+ char *rev_start)
{
#ifdef ENABLE_UTF8
if (use_utf8) {
assert(haystack != NULL && needle != NULL && rev_start != NULL);
if (needle == '\0')
- return rev_start;
+ return (char *)rev_start;
r_mb = charalloc(MB_CUR_MAX);
q_mb = charalloc(MB_CUR_MAX);
free(r_mb);
free(q_mb);
- return found_needle ? rev_start : NULL;
+ return found_needle ? (char *)rev_start : NULL;
} else
#endif
return revstrcasestr(haystack, needle, rev_start);
#endif
int mbstrncasecmp(const char *s1, const char *s2, size_t n);
#ifndef HAVE_STRCASESTR
-const char *nstrcasestr(const char *haystack, const char *needle);
+char *nstrcasestr(const char *haystack, const char *needle);
#endif
-const char *mbstrcasestr(const char *haystack, const char *needle);
+char *mbstrcasestr(const char *haystack, const char *needle);
#if !defined(NANO_TINY) || !defined(DISABLE_TABCOMP)
-const char *revstrstr(const char *haystack, const char *needle, const
- char *rev_start);
+char *revstrstr(const char *haystack, const char *needle, const char
+ *rev_start);
#endif
#ifndef NANO_TINY
-const char *revstrcasestr(const char *haystack, const char *needle,
- const char *rev_start);
-const char *mbrevstrcasestr(const char *haystack, const char *needle,
- const char *rev_start);
+char *revstrcasestr(const char *haystack, const char *needle, const char
+ *rev_start);
+char *mbrevstrcasestr(const char *haystack, const char *needle, const
+ char *rev_start);
#endif
size_t mbstrlen(const char *s);
#ifndef HAVE_STRNLEN