aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--da.h5
1 files changed, 3 insertions, 2 deletions
diff --git a/da.h b/da.h
index 8f99d01..b3ef1cb 100644
--- a/da.h
+++ b/da.h
@@ -87,9 +87,10 @@
#define dainit(a, n) \
do { \
(a)->buf = NULL; \
- (a)->cap = n; \
+ (a)->cap = (n); \
(a)->len = 0; \
- DA_ALLOC((a)->buf, (a)->cap); \
+ if (n) \
+ DA_ALLOC((a)->buf, (a)->cap); \
} while (0)
#define dapush(a, x) \