diff --git a/src/string.c b/src/string.c index 9737253..8e0ce2e 100644 --- a/src/string.c +++ b/src/string.c @@ -31,15 +31,12 @@ Str str_concat(Allocator *alloc, Str first, Str second) Str str_push(Allocator *alloc, Str str) { - U8 *mem = (U8 *)allocator_push(alloc, sizeof(Str) + str.len, alignof(Str)); - Str *new_str = (Str *)mem; - new_str->len = str.len; - new_str->str = &mem[sizeof(Str)]; + U8 *mem = (U8 *)allocator_push(alloc, str.len, 1); if (!str_is_empty(str)) { - MemCopy(new_str->str, str.str, str.len); + MemCopy(mem, str.str, str.len); } - return *new_str; + return str_create(mem, str.len); } static INLINE bool char_is_ascii_whitespace(U8 byte) @@ -85,6 +82,7 @@ Str str_ascii_trim(Str str) S64 str_substr(Str haystack, Str to_find) { + return -1; } // split @str on any byte in @separators, place split strings in @vec