summaryrefslogtreecommitdiff
path: root/src/util/array.h
diff options
context:
space:
mode:
authorDennis Camera <skonfig@dtnr.ch>2022-08-03 17:41:14 +0200
committerDennis Camera <skonfig@dtnr.ch>2022-08-03 17:58:16 +0200
commit26f555c974cf49def75120dada596f421e15f1d4 (patch)
treee45fdac5f17b04b3fb15dfd1079a9560ba9de259 /src/util/array.h
parent1fc6697f4de4290575202661b664ca617df9b8e1 (diff)
downloadskonfig-c-26f555c974cf49def75120dada596f421e15f1d4.tar.gz
skonfig-c-26f555c974cf49def75120dada596f421e15f1d4.zip
Move helper functions out to src/util/
Diffstat (limited to 'src/util/array.h')
-rw-r--r--src/util/array.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/util/array.h b/src/util/array.h
new file mode 100644
index 0000000..2e09952
--- /dev/null
+++ b/src/util/array.h
@@ -0,0 +1,18 @@
+#ifndef _SK_UTIL_ARRAY_H
+#define _SK_UTIL_ARRAY_H
+
+#include <stddef.h>
+
+#define arraylen(a) (sizeof(a)/sizeof(*a))
+
+/**
+ * anullidx:
+ * Returns the index of the first NULL element in an array.
+ *
+ * @param a: the array to search
+ * @returns the index of the first NULL element / the number of elements before
+ * NULL.
+ */
+size_t anullidx(void *a[]);
+
+#endif