aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Voss <mail@thomasvoss.com> 2024-03-15 13:05:09 +0100
committerThomas Voss <mail@thomasvoss.com> 2024-03-15 13:05:09 +0100
commitfd3b4c38ad9cf702f68bd0138c9ea0b76a25208b (patch)
tree6e8ad5dc95adc4523540c6340c06bcebfdc54ea8
parentcd9686e6bef2c69f0852d5ff84453b18111ef407 (diff)
Add DAPOP()
-rw-r--r--include/dynarr.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/include/dynarr.h b/include/dynarr.h
index 3785e18..76307e5 100644
--- a/include/dynarr.h
+++ b/include/dynarr.h
@@ -34,7 +34,9 @@
(a)->len += (n); \
} while (false)
-#define DAREMOVE(da, i) DA_REMOVE_RANGE((a), (i), (i) + 1)
+#define DAPOP(da) ((da)->buf[--(da)->len])
+
+#define DAREMOVE(da, i) DA_REMOVE_RANGE((da), (i), (i) + 1)
#define DA_REMOVE_RANGE(da, i, j) \
do { \