summaryrefslogtreecommitdiff
path: root/xs.h
diff options
context:
space:
mode:
Diffstat (limited to 'xs.h')
-rw-r--r--xs.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/xs.h b/xs.h
index d2de44a..bab315a 100644
--- a/xs.h
+++ b/xs.h
@@ -45,6 +45,10 @@ typedef char xs_data;
/* not really all, just very much */
#define XS_ALL 0xfffffff
+#ifndef xs_countof
+#define xs_countof(a) (sizeof((a)) / sizeof((*a)))
+#endif
+
void *xs_free(void *ptr);
void *_xs_realloc(void *ptr, size_t size, const char *file, int line, const char *func);
#define xs_realloc(ptr, size) _xs_realloc(ptr, size, __FILE__, __LINE__, __FUNCTION__)