public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] Fix compile error due to new strnstr()
@ 2017-08-28 15:32 Corinna Vinschen
0 siblings, 0 replies; only message in thread
From: Corinna Vinschen @ 2017-08-28 15:32 UTC (permalink / raw)
To: newlib-cvs
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=f1863582eda80694f77a90ad21d5b2eb2be9b881
commit f1863582eda80694f77a90ad21d5b2eb2be9b881
Author: Sebastian Huber <sebastian.huber@embedded-brains.de>
Date: Fri Aug 25 19:48:42 2017 +0200
Fix compile error due to new strnstr()
Remove local strnstr() implementation to fix compile error:
newlib/libc/iconv/lib/aliasesi.c:53:8: error: conflicting types for 'strnstr'
_DEFUN(strnstr, (haystack, needle, length),
^
In file included from newlib/libc/iconv/lib/aliasesi.c:29:0:
newlib/libc/include/string.h:125:10:
note: previous declaration of 'strnstr' was here
char *strnstr(const char *, const char *, size_t) __pure;
^~~~~~~
Signed-off-by: Sebastian Huber <sebastian.huber@embedded-brains.de>
Diff:
---
newlib/libc/iconv/lib/aliasesi.c | 43 ----------------------------------------
1 file changed, 43 deletions(-)
diff --git a/newlib/libc/iconv/lib/aliasesi.c b/newlib/libc/iconv/lib/aliasesi.c
index f94ac8f..41497c6 100644
--- a/newlib/libc/iconv/lib/aliasesi.c
+++ b/newlib/libc/iconv/lib/aliasesi.c
@@ -34,49 +34,6 @@
#include "local.h"
/*
- * strnstr - locate a substring in a fixed-size string.
- *
- * PARAMETERS:
- * _CONST char *haystack - the string in which to search.
- * _CONST char *needle - the string which to search.
- * int length - the maximum 'haystack' string length.
- *
- * DESCRIPTION:
- * The strstr() function finds the first occurrence of the substring
- * 'needle' in the string 'haystack'. At most 'length' bytes are searched.
- *
- * RETURN:
- * Returns a pointer to the beginning of substring, or NULL if substring
- * was not found.
- */
-static char *
-_DEFUN(strnstr, (haystack, needle, length),
- _CONST char *haystack _AND
- _CONST char *needle _AND
- int length)
-{
- _CONST char *max = haystack + length;
-
- if (*haystack == '\0')
- return *needle == '\0' ? (char *)haystack : (char *)NULL;
-
- while (haystack < max)
- {
- int i = 0;
- while (1)
- {
- if (needle[i] == '\0')
- return (char *)haystack;
- if (needle[i] != haystack[i])
- break;
- i += 1;
- }
- haystack += 1;
- }
- return (char *)NULL;
-}
-
-/*
* canonical_form - canonize 'str'.
*
* PARAMETERS:
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-08-28 15:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-28 15:32 [newlib-cygwin] Fix compile error due to new strnstr() Corinna Vinschen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).