summaryrefslogtreecommitdiff
path: root/array.h
diff options
context:
space:
mode:
Diffstat (limited to 'array.h')
-rw-r--r--array.h20
1 files changed, 6 insertions, 14 deletions
diff --git a/array.h b/array.h
index 5634dc7..ded3216 100644
--- a/array.h
+++ b/array.h
@@ -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