aboutsummaryrefslogtreecommitdiff
path: root/util.h
diff options
context:
space:
mode:
authorCraig Barnes <craigbarnes@protonmail.com>2024-01-24 23:17:28 +0000
committerDaniel Eklöf <daniel@ekloef.se>2024-02-05 11:09:52 +0000
commite0f3703ae6c4084f9275cfc78d87e5604cc27a10 (patch)
treecdfeebf67f6bb962c5543337b952fe6cf9d40587 /util.h
parentcsi: simplify handling of Set/Reset Mode (SM/RM) sequences (diff)
util: add streq() function and use in place of strcmp(...) == 0
Diffstat (limited to 'util.h')
-rw-r--r--util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/util.h b/util.h
index 683dbd4a..3746e269 100644
--- a/util.h
+++ b/util.h
@@ -1,12 +1,20 @@
#pragma once
+#include <stdbool.h>
#include <stdint.h>
+#include <string.h>
#include <threads.h>
#define ALEN(v) (sizeof(v) / sizeof((v)[0]))
#define min(x, y) ((x) < (y) ? (x) : (y))
#define max(x, y) ((x) > (y) ? (x) : (y))
+static inline bool
+streq(const char *a, const char *b)
+{
+ return strcmp(a, b) == 0;
+}
+
static inline const char *
thrd_err_as_string(int thrd_err)
{