summaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'util.h')
-rw-r--r--util.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/util.h b/util.h
index 8a21467..13a8637 100644
--- a/util.h
+++ b/util.h
@@ -21,6 +21,7 @@
#define UTIL_H
#include <stdarg.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@@ -55,4 +56,16 @@ void *xzalloc(size_t size);
void *xrealloc(void *ptr, size_t size);
char *xstrdup(const char *s);
+static inline bool xstreq(const char *str1, const char *str2)
+{
+ size_t n = strlen(str1);
+
+ if (n != strlen(str2))
+ return false;
+ if (strncmp(str1, str2, n) != 0)
+ return false;
+
+ return true;
+}
+
#endif /* UTIL_H */