diff options
author | Joshua Rowe <17525998+omnisci3nce@users.noreply.github.com> | 2024-03-14 22:08:43 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-14 22:08:43 +1100 |
commit | 70308798adbaa376da97c9c0739d437fe76b8b36 (patch) | |
tree | 09836fab6ddc9012a5f4437f2139ab0a704b3a78 /src/std/containers | |
parent | a627f75cc956a463e3910a8f5f615932bad3a418 (diff) | |
parent | b240374c23365e33727d78ca74e901bcb383e077 (diff) |
Merge pull request #5 from omnisci3nce/cel-41-port-over-a-basic-3d-scene-example
CEL 41 port over a basic 3d scene example
Diffstat (limited to 'src/std/containers')
-rw-r--r-- | src/std/containers/darray.h | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/std/containers/darray.h b/src/std/containers/darray.h index 729b4cf..25bf846 100644 --- a/src/std/containers/darray.h +++ b/src/std/containers/darray.h @@ -33,14 +33,22 @@ #define PREFIX static +/* if (arena != NULL) {\ */ +/* d = arena_alloc(arena, sizeof(T##_darray));\ */ +/* data = arena_alloc(arena, starting_capacity * sizeof(T));\ */ +/* } else {\ */ +/* }\ */ + #define KITC_DECL_TYPED_ARRAY(T) \ typedef typed_array(T) T##_darray; \ typedef typed_array_iterator(T) T##_darray_iter; \ \ /* Create a new one growable array */ \ PREFIX T##_darray *T##_darray_new(size_t starting_capacity) { \ - T##_darray *d = malloc(sizeof(T##_darray)); \ - T *data = malloc(starting_capacity * sizeof(T)); \ + T##_darray *d; \ + T *data; \ + d = malloc(sizeof(T##_darray)); \ + data = malloc(starting_capacity * sizeof(T)); \ \ d->len = 0; \ d->capacity = starting_capacity; \ |