From 114b88f931c7d99d88ad976f6e7c5bb67f1a830d Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Tue, 21 May 2024 17:57:15 +0200 Subject: Add dafields() --- include/dynarr.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'include') diff --git a/include/dynarr.h b/include/dynarr.h index 78871cb..23705c9 100644 --- a/include/dynarr.h +++ b/include/dynarr.h @@ -19,12 +19,15 @@ #endif /* clang-format on */ +#define dafields(T) \ + T *buf; \ + size_t len, cap; \ + alloc_fn alloc; \ + void *ctx; + #define dynarr(T) \ struct { \ - T *buf; \ - size_t len, cap; \ - alloc_fn alloc; \ - void *ctx; \ + dafields(T) \ } #define DAPUSH(da, x) \ -- cgit v1.2.3