diff options
| author | Daniel Hader <[email protected]> | 2026-06-28 13:11:11 -0600 |
|---|---|---|
| committer | Daniel Hader <[email protected]> | 2026-06-28 13:11:11 -0600 |
| commit | 2b61a58431d08d245d9c95cb5cec171aedb44985 (patch) | |
| tree | ef4b611100676d1f4fd0c727f439caa5c0a1170e /src/util/vec.h | |
| parent | af4a85978598f5fd32a415ebb419d190adce4b22 (diff) | |
Diffstat (limited to 'src/util/vec.h')
| -rw-r--r-- | src/util/vec.h | 21 |
1 files changed, 6 insertions, 15 deletions
diff --git a/src/util/vec.h b/src/util/vec.h index 5524947..889b649 100644 --- a/src/util/vec.h +++ b/src/util/vec.h @@ -3,6 +3,7 @@ #include <stddef.h> +#include "../error.h" #include "alloc.h" static const size_t LEO_Vec_GROWTH_FACTOR_NUMER = 3; @@ -17,22 +18,12 @@ typedef struct { size_t capacity; } LEO_Vec; -typedef enum { - LEO_Vec_OK = 0, - LEO_Vec_NULL_VEC_POINTER = 1, - LEO_Vec_NULL_ITEM_POINTER = 2, - LEO_Vec_INVALID_ITEM_SIZE = 3, - LEO_Vec_ALLOCATION_FAILURE = 4, - LEO_Vec_TOO_BIG = 5, - LEO_Vec_OUT_OF_BOUNDS = 6, -} LEO_Vec_Error; - -LEO_Vec_Error LEO_Vec_init (LEO_Vec *vec, size_t item_size, +LEO_Error LEO_Vec_init (LEO_Vec *vec, size_t item_size, LEO_Allocator allocator); -void LEO_Vec_free (LEO_Vec *vec); -LEO_Vec_Error LEO_Vec_push (LEO_Vec *vec, const void *item); -LEO_Vec_Error LEO_Vec_pop (LEO_Vec *vec, void *item); -LEO_Vec_Error LEO_Vec_get (LEO_Vec *vec, size_t i, void *item); +void LEO_Vec_free (LEO_Vec *vec); +LEO_Error LEO_Vec_push (LEO_Vec *vec, const void *item); +LEO_Error LEO_Vec_pop (LEO_Vec *vec, void *item); +LEO_Error LEO_Vec_get (LEO_Vec *vec, size_t i, void *item); #endif |
