diff options
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 |
