libpldm: Migrate ARRAY_SIZE() to internal header
This allows use of the macro throughout the codebase, discouraging
copy/paste.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia05cfbf2f1d82a80c276d60f1d9eecb2075fdc59
diff --git a/src/array.h b/src/array.h
new file mode 100644
index 0000000..05f26bd
--- /dev/null
+++ b/src/array.h
@@ -0,0 +1,8 @@
+#ifndef LIBPLDM_SRC_ARRAY_H
+#define LIBPLDM_SRC_ARRAY_H
+
+#ifndef ARRAY_SIZE
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+#endif
+
+#endif
diff --git a/src/bios_table.c b/src/bios_table.c
index 80f8098..d5cc626 100644
--- a/src/bios_table.c
+++ b/src/bios_table.c
@@ -1,3 +1,4 @@
+#include "array.h"
#include "bios_table.h"
#include "base.h"
#include "bios.h"
@@ -591,8 +592,6 @@
ssize_t (*entry_length_handler)(const void *);
};
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
-
static const struct table_entry_length *
find_table_entry_length_by_type(uint8_t attr_type,
const struct table_entry_length *handlers,