From 8e478e06c2c09e8d74fcaa6cca84f7db14d23265 Mon Sep 17 00:00:00 2001 From: Martin Kagamino Lehoux Date: Sun, 24 Aug 2025 22:53:21 +0200 Subject: improved testing & src cleanup --- include/str.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'include/str.h') diff --git a/include/str.h b/include/str.h index 153eebc..2d2eb93 100644 --- a/include/str.h +++ b/include/str.h @@ -6,20 +6,18 @@ #include "../include/memory.h" #include "../include/types.h" -#define S(s) \ - (Str) { s, lengthof(s) } typedef struct { byte *data; size len; } Str; -typedef struct { - byte *data; - size len; -} StrView; u64 Str_hash64(Str s); Str Str_copy(Arena *a, byte *data, size len); i32 Str_fprint(FILE *w, Str s); +typedef struct { + byte *data; + size len; +} StrView; StrView Str_view(byte *data, size len); Str StrView_copy(Arena *a, StrView s); @@ -28,3 +26,5 @@ Str StrView_copy(Arena *a, StrView s); #define Str_equals(a, b) \ ((a).len == (b).len) && (!(a).len || !memcmp((a).data, (b).data, (a).len)) #define Str_fprint(w, s) fprintf(w, "%.*s", (i32)(s).len, (s).data) +#define S(s) \ + (Str) { s, lengthof(s) } -- cgit v1.3