diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-24 10:40:56 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-27 11:46:25 +0200 |
| commit | dd2c70e878e4bc7fcf26f33523a45f0d854a29e4 (patch) | |
| tree | 28e0d7c8e3f213bc77c82ffbbb0bb2ba5ff5f253 /src/str.c | |
| parent | 086cb73ef88a4962345b8284e47cea52da428135 (diff) | |
code simplification & macros
Diffstat (limited to 'src/str.c')
| -rw-r--r-- | src/str.c | 13 |
1 files changed, 0 insertions, 13 deletions
@@ -5,11 +5,6 @@ #include "../include/memory.h" #include "../include/str.h" -// Returns 1 if strings are equal, 0 otherwise -i32 Str_equals(Str a, Str b) { - return (a.len == b.len) && (!a.len || !memcmp(a.data, b.data, a.len)); -} - u64 Str_hash64(Str s) { u64 h = 0x100; for (size i = 0; i < s.len; i++) { @@ -27,10 +22,6 @@ Str Str_copy(Arena *a, byte *data, size len) { return str; } -i32 Str_fprint(FILE *w, Str s) { - return fprintf(w, "%.*s", (i32)s.len, s.data); -} - StrView Str_view(byte *data, size len) { StrView str = {0}; str.len = len; @@ -38,8 +29,4 @@ StrView Str_view(byte *data, size len) { return str; } -i32 StrView_fprint(FILE *w, StrView s) { - return fprintf(w, "%.*s", (i32)s.len, s.data); -} - Str StrView_copy(Arena *a, StrView s) { return Str_copy(a, s.data, s.len); } |
