summaryrefslogtreecommitdiff
path: root/src/shared/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/util.h')
-rw-r--r--src/shared/util.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/shared/util.h b/src/shared/util.h
index 3be692ec33..63f4e3dff2 100644
--- a/src/shared/util.h
+++ b/src/shared/util.h
@@ -106,9 +106,19 @@ 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);
+ return NULL;
+}
+
+static inline const char *startswith_no_case(const char *s, const char *prefix) {
+ if (strncasecmp(s, prefix, strlen(prefix)) == 0)
+ return s + strlen(prefix);
+ return NULL;
+}
+
char *endswith(const char *s, const char *postfix) _pure_;
-char *startswith(const char *s, const char *prefix) _pure_;
-char *startswith_no_case(const char *s, const char *prefix) _pure_;
bool first_word(const char *s, const char *word) _pure_;