diff options
| author | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-22 21:15:31 +0200 |
|---|---|---|
| committer | Martin Kagamino Lehoux <martin@lehoux.net> | 2025-08-27 11:43:09 +0200 |
| commit | 07dbb6538ca55e69a33ada6761e749f4ee06affe (patch) | |
| tree | be8eaf0a1b3a20aba89a85fe6b614227655e6a39 /src/str.c | |
| parent | 911f1fe752173fdfee3f135acd2509c908c7fce2 (diff) | |
json: Improved parsing performance
Diffstat (limited to 'src/str.c')
| -rw-r--r-- | src/str.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -30,3 +30,14 @@ Str Str_copy(Arena *a, byte *data, size len) { 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; + str.data = data; + return str; +} + +i32 StrView_fprint(FILE *w, StrView s) { + return fprintf(w, "%.*s", (i32)s.len, s.data); +} |
