summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMary Ruthven <mruthven@chromium.org>2021-11-09 13:36:22 -0600
committerCommit Bot <commit-bot@chromium.org>2021-11-18 04:46:13 +0000
commit2869cee54f2aa53970234a38a7714ad7d82fe4d7 (patch)
treecb95cb9ff48ea2ab213c6bc60c7f43600e0c36f0
parent46e9f7892cfbd45bbe0e704f814224bd6319f740 (diff)
downloadchrome-ec-2869cee54f2aa53970234a38a7714ad7d82fe4d7.tar.gz
Revert "utils: Add strstr"
This reverts commit 620b7164dddf12df27d5380d647c921853c036dc. BUG=b:200823466 TEST=make buildall -j Change-Id: Ifdd8baeff50d7be572826057ad6419038f17bd61 Signed-off-by: Mary Ruthven <mruthven@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3273358 Reviewed-by: Vadim Sukhomlinov <sukhomlinov@chromium.org>
-rw-r--r--common/util.c25
-rw-r--r--include/util.h10
-rw-r--r--test/utils_str.c15
3 files changed, 0 insertions, 50 deletions
diff --git a/common/util.c b/common/util.c
index 99a7da8a2a..1087cc371a 100644
--- a/common/util.c
+++ b/common/util.c
@@ -287,31 +287,6 @@ __stdlib_compat int strncasecmp(const char *s1, const char *s2, size_t size)
}
-__stdlib_compat char *strstr(const char *s1, const char *s2)
-{
- const char *p, *q, *r;
- size_t len1 = strlen(s1);
- size_t len2 = strlen(s2);
-
- if (len1 == 0 || len2 == 0 || len1 < len2)
- return NULL;
-
- r = s1 + len1 - len2 + 1;
- for (; s1 < r; s1++) {
- if (*s1 == *s2) {
- p = s1 + 1;
- q = s2 + 1;
- for (; q < s2 + len2;) {
- if (*p++ != *q++)
- break;
- }
- if (*q == '\0')
- return (char *)s1;
- }
- }
- return NULL;
-}
-
__stdlib_compat int atoi(const char *nptr)
{
int result = 0;
diff --git a/include/util.h b/include/util.h
index 68bcbabd9b..ea5983bac0 100644
--- a/include/util.h
+++ b/include/util.h
@@ -97,16 +97,6 @@ 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>
- *
- * @param s1 String where <s2> is searched.
- * @param s2 Substring to be located in <s1>
- * @return Pointer to the located substring or NULL if not found.
- */
-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);
diff --git a/test/utils_str.c b/test/utils_str.c
index 4cb6875b5c..6498ef85d5 100644
--- a/test/utils_str.c
+++ b/test/utils_str.c
@@ -27,20 +27,6 @@ static int test_isprint(void)
isprint(' ') && !isprint('\0') && !isprint('\n'));
}
-static int test_strstr(void)
-{
- const char s1[] = "abcde";
-
- TEST_ASSERT(strstr(s1, "ab") == s1);
- TEST_ASSERT(strstr(s1, "") == NULL);
- TEST_ASSERT(strstr("", "ab") == NULL);
- TEST_ASSERT(strstr("", "x") == NULL);
- TEST_ASSERT(strstr(s1, "de") == &s1[3]);
- TEST_ASSERT(strstr(s1, "def") == NULL);
-
- return EC_SUCCESS;
-}
-
static int test_strtoi(void)
{
char *e;
@@ -266,7 +252,6 @@ void run_test(void)
RUN_TEST(test_isalpha);
RUN_TEST(test_isprint);
- RUN_TEST(test_strstr);
RUN_TEST(test_strtoi);
RUN_TEST(test_strtoul);
RUN_TEST(test_parse_bool);