summaryrefslogtreecommitdiff
path: root/include/util.h
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-11 12:34:14 -0700
committerCommit Bot <commit-bot@chromium.org>2021-02-12 01:12:31 +0000
commitdee06de21d13fad7c42fb3586e36ff56b9b51945 (patch)
treed8521fb0d4d3a87a188141d6957d04d7c35b1ed8 /include/util.h
parent23057ad0d73eb14517a51dffa9d76f7b09e3a2ed (diff)
downloadchrome-ec-dee06de21d13fad7c42fb3586e36ff56b9b51945.tar.gz
zephyr: Use string.h instead of EC definitions
The EC does not have a string.h header but instead puts these functions in the util.h header. For zephyr it is better that we use the C library, so update these. Leave along those which are specific to ECOS. BUG=b:180023514 BRANCH=none TEST=build zephyr for volteer Signed-off-by: Simon Glass <sjg@chromium.org> Change-Id: I03421e41a098501c3eb0f651c0960beab8e7428a Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2691412 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/util.h')
-rw-r--r--include/util.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/include/util.h b/include/util.h
index ba6b62761e..3970a9024f 100644
--- a/include/util.h
+++ b/include/util.h
@@ -98,6 +98,7 @@ int atoi(const char *nptr);
#ifdef CONFIG_ZEPHYR
#include <ctype.h>
+#include <string.h>
#else
int isdigit(int c);
int isspace(int c);
@@ -105,15 +106,12 @@ int isalpha(int c);
int isupper(int c);
int isprint(int c);
int tolower(int c);
-#endif
int memcmp(const void *s1, const void *s2, size_t len);
void *memcpy(void *dest, const void *src, size_t len);
void *memset(void *dest, int c, size_t len);
void *memmove(void *dest, const void *src, size_t len);
void *memchr(const void *buffer, int c, size_t n);
-int strcasecmp(const char *s1, const char *s2);
-int strncasecmp(const char *s1, const char *s2, size_t size);
/**
* Find the first occurrence of the substring <s2> in the string <s1>
@@ -125,9 +123,13 @@ int strncasecmp(const char *s1, const char *s2, size_t size);
char *strstr(const char *s1, const char *s2);
size_t strlen(const char *s);
-size_t strnlen(const char *s, size_t maxlen);
char *strncpy(char *dest, const char *src, size_t n);
int strncmp(const char *s1, const char *s2, size_t n);
+#endif
+
+int strcasecmp(const char *s1, const char *s2);
+int strncasecmp(const char *s1, const char *s2, size_t size);
+size_t strnlen(const char *s, size_t maxlen);
/* Like strtol(), but for integers. */
int strtoi(const char *nptr, char **endptr, int base);