summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-05-19 02:09:28 (GMT)
committerSimon Glass <sjg@chromium.org>2017-06-01 13:03:12 (GMT)
commit6b45ba45fbcd1acc11c88ee1c15ed5fcb49f9e32 (patch)
treeb4f0c569dbbe93e4723f2add9e26ae48a232c3fc /include/linux
parenta4b8e372d5b15d7dd302cac667e87049b59b13c7 (diff)
downloadu-boot-fsl-qoriq-6b45ba45fbcd1acc11c88ee1c15ed5fcb49f9e32.tar.xz
string: Add strchrnul()
This functions works like strchr() but returns the end of the string if the character is not found. Add an implementation of this. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/string.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h
index 091ccab..718c372 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -50,6 +50,19 @@ extern int strncasecmp(const char *s1, const char *s2, __kernel_size_t len);
#ifndef __HAVE_ARCH_STRCHR
extern char * strchr(const char *,int);
#endif
+
+/**
+ * strchrnul() - return position of a character in the string, or end of string
+ *
+ * The strchrnul() function is like strchr() except that if c is not found
+ * in s, then it returns a pointer to the nul byte at the end of s, rather than
+ * NULL
+ * @s: string to search
+ * @c: character to search for
+ * @return position of @c in @s, or end of @s if not found
+ */
+const char *strchrnul(const char *s, int c);
+
#ifndef __HAVE_ARCH_STRRCHR
extern char * strrchr(const char *,int);
#endif