diff options
| author | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-16 14:08:24 +0530 |
|---|---|---|
| committer | Aargh Rai <aargh.rai+git@gmail.com> | 2026-07-16 14:08:24 +0530 |
| commit | 1a52152852ff29c727673fc80e8bf8eca5ed6365 (patch) | |
| tree | e719771aa1b23f0b8774814ee907057f86f1dda1 /src/engine/moves/vec.c | |
| parent | 6ac448727e1e26c78055eaaa361217f64393d808 (diff) | |
starting pos, move count, test pass
Diffstat (limited to 'src/engine/moves/vec.c')
| -rw-r--r-- | src/engine/moves/vec.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/src/engine/moves/vec.c b/src/engine/moves/vec.c index b5cbb6f..6da3eb9 100644 --- a/src/engine/moves/vec.c +++ b/src/engine/moves/vec.c @@ -3,17 +3,18 @@ #include <assert.h> #include <stdlib.h> -moves_t moves_init() { - return moves_init_wcapacity(16); +void moves_init(moves_t *moves) { + return moves_init_wcapacity(moves, 16); } -moves_t moves_init_wcapacity(u32 capacity) { - move_t* moves = malloc(capacity * sizeof(*moves)); - return (moves_t) { - .moves = moves, - .capacity = capacity, - .length = 0, - }; +void moves_deinit(moves_t moves) { + free(moves.moves); +} + +void moves_init_wcapacity(moves_t *moves, u32 capacity) { + moves->moves = malloc(capacity * sizeof(*moves)); + moves->length = 0; + moves->capacity = capacity; } moves_t moves_empty() { |
