util: add a streq helper
This is a little easier to read than strcmp.
Bug: None
Test: unittests pass
Change-Id: Idccb94c2cce84b11bd9bb9eeab699254baef529d
diff --git a/util.h b/util.h
index 5ed9f94..3698263 100644
--- a/util.h
+++ b/util.h
@@ -12,6 +12,7 @@
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/types.h>
#include <syslog.h>
#include <unistd.h>
@@ -235,6 +236,14 @@
char *strip(char *s);
/*
+ * streq: determine whether two strings are equal.
+ */
+static inline bool streq(const char *s1, const char *s2)
+{
+ return strcmp(s1, s2) == 0;
+}
+
+/*
* tokenize: locate the next token in @stringp using the @delim
* @stringp A pointer to the string to scan for tokens
* @delim The delimiter to split by