diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-01-31 08:02:09 +0100 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-01-31 08:02:09 +0100 |
| commit | 8a9e6b1bd3be1041792311a86d8aac68b659e891 (patch) | |
| tree | 2a62729da17b2e6669c3d71a162525ff37e42c6a /vec.h | |
feat: First version, failing json parse string
Diffstat (limited to 'vec.h')
| -rw-r--r-- | vec.h | 20 |
1 files changed, 20 insertions, 0 deletions
@@ -0,0 +1,20 @@ +#include <stddef.h> +#include <stdint.h> + +#include "memory.h" + +#ifndef VEC_H +#define VEC_H +typedef struct { + void *data; + ptrdiff_t len; + ptrdiff_t cap; + uintptr_t size; + int align; +} Vec; +#define Vec_new(a, T, cap) _Vec_new(a, sizeof(T), cap, _Alignof(T)) +Vec *_Vec_new(Arena *a, int size, ptrdiff_t cap, int align); +Vec *Vec_push(Arena *a, Vec *v, void *data); +#define Vec_get(v, T, p) (T *)_Vec_get(v, p) +void *_Vec_get(Vec *v, int pos); +#endif |
