summaryrefslogtreecommitdiffhomepage
path: root/ir/adt
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2015-12-08 12:29:36 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2015-12-08 12:29:36 +0100
commitef64d1056826f160f309916bcb5d17803b814468 (patch)
tree900312eaa882e08a711e4d5fd767f12a8294a272 /ir/adt
parentb6a38ce579758f5a2d307d544d6fa38ec50c1c98 (diff)
util: Add 'strstart()'.
Diffstat (limited to 'ir/adt')
-rw-r--r--ir/adt/util.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/ir/adt/util.h b/ir/adt/util.h
index 9e704a1..59f3dd1 100644
--- a/ir/adt/util.h
+++ b/ir/adt/util.h
@@ -69,4 +69,13 @@ static inline bool streq(char const *const a, char const *const b)
return strcmp(a, b) == 0;
}
+static inline char const* strstart(char const* str, char const* start)
+{
+ do {
+ if (*start == '\0')
+ return str;
+ } while (*str++ == *start++);
+ return NULL;
+}
+
#endif