summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/shared/util.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index dd1c515f90..d5c6705497 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -117,9 +117,13 @@ static inline bool isempty(const char *p) {
return !p || !p[0];
}
-static inline const char *startswith(const char *s, const char *prefix) {
- if (strncmp(s, prefix, strlen(prefix)) == 0)
- return s + strlen(prefix);
+static inline char *startswith(const char *s, const char *prefix) {
+ size_t l;
+
+ l = strlen(prefix);
+ if (strncmp(s, prefix, l) == 0)
+ return (char*) s + l;
+
return NULL;
}