Browse Source

Merge branch 'master' of https://github.com/rsachetto/stb into working

Sean Barrett 6 years ago
parent
commit
8cf9f5adb4
1 changed files with 4 additions and 1 deletions
  1. 4 1
      stb_ds.h

+ 4 - 1
stb_ds.h

@@ -212,7 +212,8 @@ DOCUMENTATION
       shputs
       shputs
         T hmputs(T*, T item)
         T hmputs(T*, T item)
         T shputs(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
       hmdel
       shdel
       shdel
@@ -320,6 +321,7 @@ CREDITS
 #define arrlenu     stbds_arrlenu
 #define arrlenu     stbds_arrlenu
 #define arrput      stbds_arrput
 #define arrput      stbds_arrput
 #define arrpush     stbds_arrput
 #define arrpush     stbds_arrput
+#define arrpop      stbds_arrpop
 #define arrfree     stbds_arrfree
 #define arrfree     stbds_arrfree
 #define arraddn     stbds_arraddn
 #define arraddn     stbds_arraddn
 #define arrsetlen   stbds_arrsetlen
 #define arrsetlen   stbds_arrsetlen
@@ -435,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_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_arrput(a,v)     (stbds_arrmaybegrow(a,1), (a)[stbds_header(a)->length++] = (v))
 #define stbds_arrpush         stbds_arrput  // synonym
 #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_arraddn(a,n)    (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n))
 #define stbds_arrlast(a)      ((a)[stbds_header(a)->length-1])
 #define stbds_arrlast(a)      ((a)[stbds_header(a)->length-1])
 #define stbds_arrfree(a)      ((void) ((a) ? realloc(stbds_header(a),0) : 0), (a)=NULL)
 #define stbds_arrfree(a)      ((void) ((a) ? realloc(stbds_header(a),0) : 0), (a)=NULL)