From 8a9e6b1bd3be1041792311a86d8aac68b659e891 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Fri, 31 Jan 2025 08:02:09 +0100 Subject: feat: First version, failing json parse string --- string.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 string.h (limited to 'string.h') 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 +#include + +#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 -- cgit v1.3