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 /string.h | |
feat: First version, failing json parse string
Diffstat (limited to 'string.h')
| -rw-r--r-- | string.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/string.h b/string.h new file mode 100644 index 0000000..c441373 --- /dev/null +++ b/string.h @@ -0,0 +1,17 @@ +#include <stddef.h> +#include <stdint.h> + +#include "memory.h" + +#ifndef STRING_H +#define STRING_H +#define S(s) (Str){s, sizeof(s) - 1} +typedef struct { + char *data; + ptrdiff_t len; +} Str; +Str *Str_new(Arena *a, uintptr_t len); +int Str_equals(Str a, Str b); +uint64_t Str_hash64(Str s); +Str Str_copy(Arena *a, char *data, uintptr_t len); +#endif |
