summaryrefslogtreecommitdiff
path: root/src/util/array.h
diff options
context:
space:
mode:
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