Adding arrpop macro to stb_ds.h

This commit is contained in:
Rafael Sachetto 2019-03-01 14:04:31 -03:00
parent 89bccdd567
commit caf9608826

View File

@ -321,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
@ -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_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)