From 89bccdd5676b2c6c718868cef98b8c6a1f9a577e Mon Sep 17 00:00:00 2001 From: Rafael Sachetto Date: Tue, 26 Feb 2019 09:37:16 -0300 Subject: [PATCH 1/2] Small documentation correction --- stb_ds.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/stb_ds.h b/stb_ds.h index 96c64d5..fff612e 100644 --- a/stb_ds.h +++ b/stb_ds.h @@ -212,7 +212,8 @@ DOCUMENTATION shputs T hmputs(T*, T item) T shputs(T*, T item) - Returns the structure corresponding to 'key' in the hashmap. + Inserts a struct with T.key and T.value into the hashmap. If the struct is already + present in the hashmap, updates it. hmdel shdel From caf960882650c77c3ebc59ea7739f5e9dc947420 Mon Sep 17 00:00:00 2001 From: Rafael Sachetto Date: Fri, 1 Mar 2019 14:04:31 -0300 Subject: [PATCH 2/2] Adding arrpop macro to stb_ds.h --- stb_ds.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stb_ds.h b/stb_ds.h index fff612e..fccc5f3 100644 --- a/stb_ds.h +++ b/stb_ds.h @@ -321,6 +321,7 @@ CREDITS #define arrlenu stbds_arrlenu #define arrput stbds_arrput #define arrpush stbds_arrput +#define arrpop stbds_arrpop #define arrfree stbds_arrfree #define arraddn stbds_arraddn #define arrsetlen stbds_arrsetlen @@ -436,6 +437,7 @@ extern void * stbds_shmode_func(size_t elemsize, int mode); #define stbds_arrlenu(a) ((a) ? stbds_header(a)->length : 0) #define stbds_arrput(a,v) (stbds_arrmaybegrow(a,1), (a)[stbds_header(a)->length++] = (v)) #define stbds_arrpush stbds_arrput // synonym +#define stbds_arrpop(a) (stbds_header(a)->length--, (a)[stbds_header(a)->length]) #define stbds_arraddn(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n)) #define stbds_arrlast(a) ((a)[stbds_header(a)->length-1]) #define stbds_arrfree(a) ((void) ((a) ? realloc(stbds_header(a),0) : 0), (a)=NULL)