Commit 2b4402a2eb769abead4dd3371af94390722b5c3c

Stefan Sperling 2017-11-05T13:48:22

only define nitems() if it is not already defined

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
diff --git a/lib/error.c b/lib/error.c
index d4a8f42..ab4b7f6 100644
--- a/lib/error.c
+++ b/lib/error.c
@@ -16,7 +16,9 @@
 
 #include "got_error.h"
 
-#define nitems(a) (sizeof(a) / sizeof((a)[0]))
+#ifndef nitems
+#define nitems(_a) (sizeof(_a) / sizeof((_a)[0]))
+#endif
 
 const struct got_error *
 got_error(int code)