From d1c7b71043c7558f2fc89fe0d78d48a0c0c6b35e Mon Sep 17 00:00:00 2001 From: Jeremy Baxter Date: Sat, 1 Jul 2023 09:53:43 +1200 Subject: [PATCH] Define streq macro in util.h and use it over strcmp in lprocess.c --- lprocess.c | 2 +- util.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/lprocess.c b/lprocess.c index 38aa534..fadf391 100644 --- a/lprocess.c +++ b/lprocess.c @@ -135,7 +135,7 @@ strtosig(const char *sig) int i; for (i = 1; i <= SIGC; i++) { - if (strcmp(signals[i], sig) == 0) { + if (streq(signals[i], sig)) { return i; /* valid signal found */ } } diff --git a/util.h b/util.h index 0942afd..2bbb69b 100644 --- a/util.h +++ b/util.h @@ -1,7 +1,9 @@ +#include #include #define LFAIL_RET 2 +#define streq(s1, s2) (strcmp((s1), (s2)) == 0) #define newoverride(L, lib, libname) \ lua_getglobal(L, libname); \ for (int i = 0; lib[i].name != NULL; i++) { \