aboutsummaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-09-01 10:39:36 -0400
committerGitHub <noreply@github.com>2018-09-01 10:39:36 -0400
commit89a045835f284e368f36ea5b508f70a41f65d6be (patch)
tree7c966de2d4c3dacdbf337a7c817bf6aa6701d1ab /common
parent692dc55ecaff66cf379aaf05a4a0c86f517a4dc1 (diff)
parent7e81e58e7d1f540e448f3827751f75bf54b1fe9f (diff)
downloadsway-89a045835f284e368f36ea5b508f70a41f65d6be.tar.xz
Merge pull request #2547 from RyanDwyer/fix-reload-crash
Fix crash on reload
Diffstat (limited to 'common')
-rw-r--r--common/stringop.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/common/stringop.c b/common/stringop.c
index d9ae9925..d2c91c24 100644
--- a/common/stringop.c
+++ b/common/stringop.c
@@ -401,3 +401,17 @@ char *argsep(char **stringp, const char *delim) {
found:
return start;
}
+
+const char *strcasestr(const char *haystack, const char *needle) {
+ size_t needle_len = strlen(needle);
+ const char *pos = haystack;
+ const char *end = pos + strlen(haystack) - needle_len;
+
+ while (pos <= end) {
+ if (strncasecmp(pos, needle, needle_len) == 0) {
+ return pos;
+ }
+ ++pos;
+ }
+ return NULL;
+}