summaryrefslogtreecommitdiff
path: root/utils.h
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2020-06-21 00:06:29 +0200
committerDavid Härdeman <david@hardeman.nu>2020-06-21 00:06:29 +0200
commitae48dc3b3caeef7eaa4a079b11cdda988d9c1f0d (patch)
tree2b9ec4898b7fd71ae3551ee72f7891640dec5c07 /utils.h
parentab51ac11e68ce0b075688bf17fc89e0ba645b2ed (diff)
Add streq and strcaseeq and use them throughout
Diffstat (limited to 'utils.h')
-rw-r--r--utils.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/utils.h b/utils.h
index f87159e..a38602c 100644
--- a/utils.h
+++ b/utils.h
@@ -2,6 +2,7 @@
#define fooutilshfoo
#include <stdio.h>
+#include <string.h>
#include <stdbool.h>
#include <stdlib.h>
#include <linux/if_packet.h>
@@ -91,6 +92,16 @@ static inline bool empty_str(const char *str)
return false;
}
+static inline bool streq(const char *a, const char *b)
+{
+ return strcmp(a, b) == 0;
+}
+
+static inline bool strcaseeq(const char *a, const char *b)
+{
+ return strcasecmp(a, b) == 0;
+}
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define chtobe32(x) __bswap_constant_32(x)
#else