You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ad...@apache.org on 2017/04/19 18:18:09 UTC

[13/30] incubator-mynewt-core git commit: baselibc; add strnstr() - used by lwip.

baselibc; add strnstr() - used by lwip.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/73a32024
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/73a32024
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/73a32024

Branch: refs/heads/master
Commit: 73a320244d4fd89124bc3b2d38e1aac597729749
Parents: e9ab595
Author: Marko Kiiskila <ma...@runtime.io>
Authored: Fri Apr 14 10:46:49 2017 -0700
Committer: Marko Kiiskila <ma...@runtime.io>
Committed: Fri Apr 14 13:21:30 2017 -0700

----------------------------------------------------------------------
 libc/baselibc/include/string.h | 1 +
 libc/baselibc/src/strstr.c     | 5 +++++
 2 files changed, 6 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/73a32024/libc/baselibc/include/string.h
----------------------------------------------------------------------
diff --git a/libc/baselibc/include/string.h b/libc/baselibc/include/string.h
index a483a15..3595470 100644
--- a/libc/baselibc/include/string.h
+++ b/libc/baselibc/include/string.h
@@ -45,6 +45,7 @@ __extern char *strpbrk(const char *, const char *);
 __extern char *strsep(char **, const char *);
 __extern size_t strspn(const char *, const char *);
 __extern char *strstr(const char *, const char *);
+__extern char *strnstr(const char *, const char *, size_t);
 __extern char *strtok(char *, const char *);
 __extern char *strtok_r(char *, const char *, char **);
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/73a32024/libc/baselibc/src/strstr.c
----------------------------------------------------------------------
diff --git a/libc/baselibc/src/strstr.c b/libc/baselibc/src/strstr.c
index 8850858..0af23bb 100644
--- a/libc/baselibc/src/strstr.c
+++ b/libc/baselibc/src/strstr.c
@@ -9,3 +9,8 @@ char *strstr(const char *haystack, const char *needle)
 	return (char *)memmem(haystack, strlen(haystack), needle,
 			      strlen(needle));
 }
+
+char *strnstr(const char *haystack, const char *needle, size_t len)
+{
+	return (char *)memmem(haystack, strlen(haystack), needle, len);
+}