X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=demo_prior;a=blobdiff_plain;f=libs%2Ftreestore%2Fsrc%2Fdynarr.h;fp=libs%2Ftreestore%2Fsrc%2Fdynarr.h;h=513a4314df5fbbbc33fcf0bf50e3336aa99329a8;hp=0000000000000000000000000000000000000000;hb=44a7a61d2bec54ed741930572e63e5015326daca;hpb=ec776ad8bf37d25b9308e2c770d66247135b46ea diff --git a/libs/treestore/src/dynarr.h b/libs/treestore/src/dynarr.h new file mode 100644 index 0000000..513a431 --- /dev/null +++ b/libs/treestore/src/dynarr.h @@ -0,0 +1,69 @@ +/* dynarr - dynamic resizable C array data structure + * author: John Tsiombikas + * license: public domain + */ +#ifndef DYNARR_H_ +#define DYNARR_H_ + +/* usage example: + * ------------- + * int *arr = ts_dynarr_alloc(0, sizeof *arr); + * + * int x = 10; + * arr = ts_dynarr_push(arr, &x); + * x = 5; + * arr = ts_dynarr_push(arr, &x); + * x = 42; + * arr = ts_dynarr_push(arr, &x); + * + * for(i=0; i