summaryrefslogtreecommitdiff
path: root/array.h
blob: 848e1a7c53503da8dc489952e3f62d1d177c4cd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#ifndef __SAFEC_ARRAY_H
#define __SAFEC_ARRAY_H
#include <stddef.h>

/* TODO: it might be good to just have itemsz and char* data */
typedef struct {
    size_t length;
    void** data;
} array_t;

void array_set(array_t* array, size_t idx, void* val);
void* array_get(const array_t* array, size_t idx);

typedef struct {
    size_t length;
    char* data;
} str_t;

void str_set(str_t* str, size_t idx, char val);
char str_get(const str_t* str, size_t idx);
/* TODO: I would like to implement string slicing as part of this */
/* TODO: reimplement string.h functions for this new string construct */
#endif