Setting a user context with stbds_arrctx() permits custom allocator functions (STBDS_REALLOC() and STBDS_FREE()) to forward that context.
The array might be allocated during the call if it was not.
Hence it's preferable to reassign the pointer on function return:
my_array = stbds_arrctx(my_array, my_context);
The stbds_arrgrowf() prototype has been modified to pass that context pointer. Hash map functions have been updated to call correctly the allocation function, but context is still not used for those (I'm not using the hash map functions myself, so I preferred to not break them).
The only issue I can see with this implementation is the grow in stbds_array_header structure, not power of 16 sized anymore (possible alignment issue?).
The
stbds_arrgrowf()
prototype has been modified to pass that context pointer. Hash map functions have been updated to call correctly the allocation function, but context is still not used for those (I'm not using the hash map functions myself, so I preferred to not break them).The only issue I can see with this implementation is the grow in stbds_array_header structure, not power of 16 sized anymore (possible alignment issue?).