From fd3b4c38ad9cf702f68bd0138c9ea0b76a25208b Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Fri, 15 Mar 2024 13:05:09 +0100 Subject: Add DAPOP() --- include/dynarr.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include') 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 { \ -- cgit v1.2.3