summaryrefslogtreecommitdiff
path: root/xs.h
diff options
context:
space:
mode:
authordefault <nobody@localhost>2024-04-14 19:26:49 +0200
committerdefault <nobody@localhost>2024-04-14 19:26:49 +0200
commit0275658a3602f74035ff776dac8d8f64b9a2794f (patch)
treed9489684e46d7cd0d5bd8347a880316abe22f48f /xs.h
parent81cf1e21a646568323681df2763e66f933bee48f (diff)
Backport from xs.
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__)