only define nitems() if it is not already defined
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)