diff options
| author | Carson Fleming <[email protected]> | 2026-01-25 16:00:20 -0500 |
|---|---|---|
| committer | Carson Fleming <[email protected]> | 2026-01-25 16:00:20 -0500 |
| commit | b364a39849fc4a6f6837f8558b7520efc24ae96c (patch) | |
| tree | 2f1d3be07c225bd2c29b219df8ec184c256a9e4f /array.h | |
| parent | aecec4204b5830fcb97ab93a56a6a29018519ca2 (diff) | |
| download | safec-b364a39849fc4a6f6837f8558b7520efc24ae96c.tar.gz | |
bring in some library functions and restructure
Diffstat (limited to 'array.h')
| -rw-r--r-- | array.h | 20 |
1 files changed, 6 insertions, 14 deletions
@@ -1,6 +1,6 @@ #ifndef __SAFEC_ARRAY_H #define __SAFEC_ARRAY_H -#include <stddef.h> +#include "types.h" typedef struct { size_t length; @@ -8,20 +8,12 @@ typedef struct { void* __data; } array_t; -void* array_at(const array_t* array, size_t idx); +void* array_at(const array_t array, size_t idx); +array_t array_slice(const array_t array, size_t start, size_t length); -typedef struct { - size_t length; - char* __data; -} str_t; +array_t array_init(void* data, size_t length, size_t elemsz); -char* str_at(const str_t* str, size_t idx); -str_t str_slice(const str_t* str, size_t start, size_t length); -void str_c_str( - char* dst, - size_t dst_size, - const str_t* src -); +array_t array_heap_alloc(size_t length, size_t elemsz); +void array_heap_destroy(array_t array); -/* TODO: reimplement string.h functions for this new string construct */ #endif |
