lib: Add array-size header
authorJeremy Kerr <jk@ozlabs.org>
Fri, 13 Sep 2013 08:00:51 +0000 (16:00 +0800)
committerJeremy Kerr <jk@ozlabs.org>
Tue, 24 Sep 2013 05:14:59 +0000 (13:14 +0800)
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
lib/array-size/array-size.h [new file with mode: 0644]
lib/pb-config/storage-test.c

diff --git a/lib/array-size/array-size.h b/lib/array-size/array-size.h
new file mode 100644 (file)
index 0000000..12d59f8
--- /dev/null
@@ -0,0 +1,7 @@
+#ifndef ARRAY_SIZE_H
+#define ARRAY_SIZE_H
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
+
+#endif /* ARRAY_SIZE_H */
+
index 3114712b4825cb60625ac3d76640004e531fd2fa..3ce58ef0a03c30b39ea44ac9b0abbfa79a58eea1 100644 (file)
@@ -4,6 +4,8 @@
 #include <sys/types.h>
 #include <sys/wait.h>
 
+#include <array-size/array-size.h>
+
 #include "pb-config.h"
 #include "storage.h"
 
@@ -24,8 +26,6 @@ struct interface_config net2 = {
 struct interface_config *interface_configs[] = { &net1, &net2 };
 const char *dns_servers[] = { "192.168.1.1", "192.168.1.2" };
 
-#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
-
 struct config test_config = {
        .autoboot_enabled = true,
        .network = {