Skip to content
Myr

Fix stb_ds custom allocator

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Andreas Vennström · committed by Andreas Vennström · parent c9064e3 · Browse files · 1 file+7 added−1 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+7 added−1 removed

  • other:+7 added−1 removed

1 file+7 added−1 removed

modified:stb_ds.h+7 added-1 removed
487 unmodified lines
488// Everything below here is implementation details489//490491extern void * stbds_arrgrowf(void *a, size_t elemsize, size_t addlen, size_t min_cap);492extern void stbds_arrfreef(void *a);493extern void stbds_hmfree_func(void *p, size_t elemsize);494extern void * stbds_hmget_key(void *a, size_t elemsize, void *key, size_t keysize, int mode);495extern void * stbds_hmget_key_ts(void *a, size_t elemsize, void *key, size_t keysize, ptrdiff_t *temp, int mode);496extern void * stbds_hmput_default(void *a, size_t elemsize);
46 unmodified lines
543#define stbds_arraddn(a,n) ((void)(stbds_arraddnoff(a, n))) // deprecated, use one of the following instead:544#define stbds_arraddnptr(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n), &(a)[stbds_header(a)->length-(n)])545#define stbds_arraddnoff(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n), stbds_header(a)->length-(n))546#define stbds_arrlast(a) ((a)[stbds_header(a)->length-1])546#define stbds_arrfree(a) ((void) ((a) ? STBDS_FREE(NULL,stbds_header(a)) : (void)0), (a)=NULL)547#define stbds_arrfree(a) ((void) ((a) ? stbds_arrfreef(a) : (void)0), (a)=NULL)548#define stbds_arrdel(a,i) stbds_arrdeln(a,i,1)549#define stbds_arrdeln(a,i,n) (memmove(&(a)[i], &(a)[(i)+(n)], sizeof *(a) * (stbds_header(a)->length-(n)-(i))), stbds_header(a)->length -= (n))550#define stbds_arrdelswap(a,i) ((a)[i] = stbds_arrlast(a), stbds_header(a)->length -= 1)551#define stbds_arrinsn(a,i,n) (stbds_arraddn((a),(n)), memmove(&(a)[(i)+(n)], &(a)[i], sizeof *(a) * (stbds_header(a)->length-(n)-(i))))
237 unmodified lines
789790 return b;791}792793void stbds_arrfreef(void *a)794{795 STBDS_FREE(NULL, stbds_header(a));796}797798//799// stbds_hm hash table implementation800//801
1085 unmodified lines