diff options
author | Drew DeVault <sir@cmpwn.com> | 2018-09-01 10:39:36 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-09-01 10:39:36 -0400 |
commit | 89a045835f284e368f36ea5b508f70a41f65d6be (patch) | |
tree | 7c966de2d4c3dacdbf337a7c817bf6aa6701d1ab /common | |
parent | Merge pull request #2549 from RyanDwyer/border-improvements (diff) | |
parent | Allow reload command to exist anywhere in the command string (diff) | |
download | sway-89a045835f284e368f36ea5b508f70a41f65d6be.tar.gz sway-89a045835f284e368f36ea5b508f70a41f65d6be.tar.zst sway-89a045835f284e368f36ea5b508f70a41f65d6be.zip |
Merge pull request #2547 from RyanDwyer/fix-reload-crash
Fix crash on reload
Diffstat (limited to 'common')
-rw-r--r-- | common/stringop.c | 14 |
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) { | |||
401 | found: | 401 | found: |
402 | return start; | 402 | return start; |
403 | } | 403 | } |
404 | |||
405 | const char *strcasestr(const char *haystack, const char *needle) { | ||
406 | size_t needle_len = strlen(needle); | ||
407 | const char *pos = haystack; | ||
408 | const char *end = pos + strlen(haystack) - needle_len; | ||
409 | |||
410 | while (pos <= end) { | ||
411 | if (strncasecmp(pos, needle, needle_len) == 0) { | ||
412 | return pos; | ||
413 | } | ||
414 | ++pos; | ||
415 | } | ||
416 | return NULL; | ||
417 | } | ||