summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-05-19 02:09:29 (GMT)
committerSimon Glass <sjg@chromium.org>2017-06-01 13:03:12 (GMT)
commita7d0021063661a65bfa47d4ec912da4e2cfa8f9a (patch)
treec4f46f6084a9f3b9ca3795d68195a9ed11274f66 /include/linux
parent6b45ba45fbcd1acc11c88ee1c15ed5fcb49f9e32 (diff)
downloadu-boot-fsl-qoriq-a7d0021063661a65bfa47d4ec912da4e2cfa8f9a.tar.xz
string: Add strcspn()
Add an implementation of strcspn() which returns the number of initial characters that do not match any in a rejection list. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/string.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/string.h b/include/linux/string.h
index 718c372..3606620 100644
--- a/include/linux/string.h
+++ b/include/linux/string.h
@@ -76,6 +76,21 @@ extern __kernel_size_t strlen(const char *);
#ifndef __HAVE_ARCH_STRNLEN
extern __kernel_size_t strnlen(const char *,__kernel_size_t);
#endif
+
+#ifndef __HAVE_ARCH_STRCSPN
+/**
+ * strcspn() - find span of string without given characters
+ *
+ * Calculates the length of the initial segment of @s which consists entirely
+ * of bsytes not in reject.
+ *
+ * @s: string to search
+ * @reject: strings which cause the search to halt
+ * @return number of characters at the start of @s which are not in @reject
+ */
+size_t strcspn(const char *s, const char *reject);
+#endif
+
#ifndef __HAVE_ARCH_STRDUP
extern char * strdup(const char *);
#endif