summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRob Barnes <robbarnes@google.com>2021-07-27 15:29:51 -0600
committerCommit Bot <commit-bot@chromium.org>2021-08-09 16:43:13 +0000
commitb82517a459d8e9394a1ea4a2a0148232c61f45e5 (patch)
tree9d37d20245dae1e41e074c80ae064c5823d12003 /include
parent48f83b8b045e4105c4811bf8982cc109e7408b9e (diff)
downloadchrome-ec-b82517a459d8e9394a1ea4a2a0148232c61f45e5.tar.gz
util: Add strcspn
Add the standard string function strcspn. strcspn calculates the length of the initial segment of s which consists entirely of bytes not in reject. BUG=None TEST=make run-utils_str BRANCH=None Signed-off-by: Rob Barnes <robbarnes@google.com> Change-Id: I3eb9a4fff42cb0fdcdb288d00f8070e0f22b2179 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3057730 Reviewed-by: Daisuke Nojiri <dnojiri@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/util.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/util.h b/include/util.h
index 21603484bb..4ed352f0d7 100644
--- a/include/util.h
+++ b/include/util.h
@@ -124,6 +124,12 @@ void *memchr(const void *buffer, int c, size_t n);
*/
char *strstr(const char *s1, const char *s2);
+/**
+ * Calculates the length of the initial segment of s which consists
+ * entirely of bytes not in reject.
+ */
+size_t strcspn(const char *s, const char *reject);
+
size_t strlen(const char *s);
char *strncpy(char *dest, const char *src, size_t n);
int strncmp(const char *s1, const char *s2, size_t n);