Radish alpha
H
rad:z3QDZAW2FAfuLvihrhiyDC9fAD8G9
HardenedBSD Package Manager
Radicle
Git
streq: generalize the macro
Baptiste Daroussin committed 1 year ago
commit 91b1b5242ad35746eef336cddea1ba955d351db3
parent 053f4a2
3 files changed +12 -2
modified libpkg/pkg.h.in
@@ -86,6 +86,14 @@ extern "C" {
#define NELEM(array)    (sizeof(array) / sizeof((array)[0]))
#endif

+
#ifndef STREQ
+
#define STREQ(s1, s2) (strcmp(s1, s2) == 0)
+
#endif
+

+
#ifndef STRIEQ
+
#define STRIEQ(s1, s2) (strcasecmp(s1, s2) == 0)
+
#endif
+

/* Special exit status for worker processes indicating that a restart
 * is desired -- eg. after a child has updated pkg(8) itself.
 */
modified libpkg/pkghash.c
@@ -31,6 +31,10 @@
#include <mum.h>
#include <xmalloc.h>

+
#ifndef STREQ
+
#define STREQ(s1, s2) (strcmp(s1, s2) == 0)
+
#endif
+

struct pkghash {
	pkghash_entry *entries;
	size_t capacity;
modified libpkg/private/utils.h
@@ -39,8 +39,6 @@
#include <xstring.h>

#define STARTS_WITH(string, needle) (strncasecmp(string, needle, strlen(needle)) == 0)
-
#define STRIEQ(string, needle) (strcasecmp(string, needle) == 0)
-
#define STREQ(string, needle) (strcmp(string, needle) == 0)
#define RELATIVE_PATH(p) (p + (*p == '/' ? 1 : 0))

typedef tll(char *) stringlist_t;