summaryrefslogtreecommitdiff
path: root/src/aplwc_internal.h
diff options
context:
space:
mode:
authorpeter <peter@pmikkelsen.com>2026-08-08 15:38:35 +0000
committerpeter <peter@pmikkelsen.com>2026-08-08 15:38:35 +0000
commitb1d9069f57439bed333d83c7041871c54f0b8d97 (patch)
tree10048b0fc474a6e9ff91affc44455191a651cd5e /src/aplwc_internal.h
parent059ecb51f46d5c86f8d9abbe3914d0a028725957 (diff)
Initial import of code
FossilOrigin-Name: 1bd90d4b94de6d63bd8639b8eae399c3dabf321e704ff08c03e99bbe6dfb7764
Diffstat (limited to 'src/aplwc_internal.h')
-rw-r--r--src/aplwc_internal.h32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/aplwc_internal.h b/src/aplwc_internal.h
new file mode 100644
index 0000000..f80c8ab
--- /dev/null
+++ b/src/aplwc_internal.h
@@ -0,0 +1,32 @@
+#ifndef APLWC_INTERNAL_H
+#define APLWC_INTERNAL_H
+
+#define UNUSED_PARAMETER(arg) ((void)arg)
+
+#define RETURN_ERROR(aplwc, rc, msg) do{ \
+ Aplwc *_p = (aplwc); \
+ AplwcRc _r = APLWC_##rc; \
+ if(_p) _p->last_error = _r; \
+ return _r; \
+ }while(0)
+
+#define NELEM(x) (sizeof(x)/sizeof(x[0]))
+
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+struct Aplwc {
+ AplwcRc last_error;
+ char last_error_msg[64];
+};
+
+/* errors.c */
+const char *rc_to_string(AplwcRc);
+
+/* malloc.c */
+void *malloc_zero(size_t);
+
+#endif /* APLWC_INTERNAL_H */