mirror of https://github.com/nothings/stb.git
Fix arraddn returning index instead of pointer
The documentation of that operation already said: > Returns a pointer to the first uninitialized item added. This also makes a lot of sense, allowing easy initialization. But the implementation returned the index of the first uninitialized element instead.
This commit is contained in:
parent
f54acd4e13
commit
e423b41e74
3
stb_ds.h
3
stb_ds.h
|
@ -370,6 +370,7 @@ CREDITS
|
|||
Andy Durdin
|
||||
Shane Liesegang
|
||||
Vinh Truong
|
||||
Andreas Molzer
|
||||
*/
|
||||
|
||||
#ifdef STBDS_UNIT_TESTS
|
||||
|
@ -521,7 +522,7 @@ extern void * stbds_shmode_func(size_t elemsize, int mode);
|
|||
#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), stbds_header(a)->length-(n))
|
||||
#define stbds_arraddn(a,n) (stbds_arrmaybegrow(a,n), stbds_header(a)->length += (n), &(a)[stbds_header(a)->length-(n)])
|
||||
#define stbds_arrlast(a) ((a)[stbds_header(a)->length-1])
|
||||
#define stbds_arrfree(a) ((void) ((a) ? STBDS_FREE(NULL,stbds_header(a)) : (void)0), (a)=NULL)
|
||||
#define stbds_arrdel(a,i) stbds_arrdeln(a,i,1)
|
||||
|
|
Loading…
Reference in New Issue