diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-21 00:06:29 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-21 00:06:29 +0200 |
commit | ae48dc3b3caeef7eaa4a079b11cdda988d9c1f0d (patch) | |
tree | 2b9ec4898b7fd71ae3551ee72f7891640dec5c07 /utils.h | |
parent | ab51ac11e68ce0b075688bf17fc89e0ba645b2ed (diff) |
Add streq and strcaseeq and use them throughout
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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 |