]> git.draconx.ca Git - dxcommon.git/commitdiff
copysym: Avoid including xtra.h.
authorNick Bowler <nbowler@draconx.ca>
Tue, 30 May 2023 00:35:15 +0000 (20:35 -0400)
committerNick Bowler <nbowler@draconx.ca>
Tue, 30 May 2023 00:35:15 +0000 (20:35 -0400)
Using the xtra.h header just for the arraysize macro is just added
complexity for downstream projects (who then need to ensure the xtra.h
header is distributed even if they don't otherwise need it).

src/copysym.c

index 8ecace7c32a68d924bb9a2ca2932ad9d578f04a5..7de9e982ceb14dffe89e47816dec57db05aa354c 100644 (file)
@@ -17,7 +17,8 @@
 #include <stdlib.h>
 #include <string.h>
 #include <stdint.h>
-#include "xtra.h"
+
+#define ARRAYSIZE(x) (sizeof (x) / sizeof (x)[0])
 
 static int compar_5arr(const void *key, const void *elem_)
 {
@@ -130,7 +131,7 @@ const char *copyright_symbol(const char *charset)
        if (!charset)
                goto no_conv;
 
-       m1 = bsearch(charset, t1, XTRA_ARRAYSIZE(t1), sizeof *t1, compar_5arr);
+       m1 = bsearch(charset, t1, ARRAYSIZE(t1), sizeof *t1, compar_5arr);
        if (!m1)
                goto no_conv;
        charset += 5;