diff options
author | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-12-19 08:44:53 +0000 |
---|---|---|
committer | Aryadev Chavali <aryadev@aryadevchavali.com> | 2024-12-19 08:44:53 +0000 |
commit | ffc8068a74cca75a66296e8bec06d1ef47d7c830 (patch) | |
tree | a97c33e70f34f0ba4ebe0b48504d4bccdc88afd0 /lib.h | |
parent | 2a4d7addaea5883213841b3ab6372346e70ccef3 (diff) | |
download | obf-ffc8068a74cca75a66296e8bec06d1ef47d7c830.tar.gz obf-ffc8068a74cca75a66296e8bec06d1ef47d7c830.tar.bz2 obf-ffc8068a74cca75a66296e8bec06d1ef47d7c830.zip |
Introduce and implement vec_t
A vec_t is a dynamic array, separate to a buffer. Should make it
easier to distinguish purposes using these two data types.
Diffstat (limited to 'lib.h')
-rw-r--r-- | lib.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -34,4 +34,16 @@ typedef struct Buffer } buffer_t; buffer_t *buffer_init_str(const char *name, const char *str, size_t str_size); + +typedef struct +{ + u64 size, capacity; + u8 *data; +} vec_t; + +void vec_append(vec_t *vec, void *ptr, u64 size); +void vec_ensure(vec_t *vec, u64 abs_size); +void vec_ensure_free(vec_t *vec, u64 rel_size); +void vec_free(vec_t *vec); + #endif |