diff options
author | talha <talha@talhaamir.xyz> | 2024-03-13 23:18:29 +0500 |
---|---|---|
committer | talha <talha@talhaamir.xyz> | 2024-03-13 23:18:29 +0500 |
commit | 832bafccff577246dde2d11c23582f6a644c6c94 (patch) | |
tree | 2f46f6d2c0a3a3e0885494c985f151fbd93578a0 /strings/strings.cpp | |
parent | ab3edaa58eed4ff73410954ca094531d49eb5844 (diff) |
Refactored Memory, Removed Strings
Diffstat (limited to 'strings/strings.cpp')
-rw-r--r-- | strings/strings.cpp | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/strings/strings.cpp b/strings/strings.cpp deleted file mode 100644 index 4c8486f..0000000 --- a/strings/strings.cpp +++ /dev/null @@ -1,31 +0,0 @@ -u64 CstrSize(const char* cstr) -{ - u8 *iter = (u8*)cstr; - u64 size = 0; - for(;*iter != 0; *iter++) { - size += 1; - } - - return size; -} - -struct str8 Str8(u8 *string, u64 size) -{ - struct str8 result = {string, size}; - return result; -} - -struct res_str8 Str8InitCstr(struct arena *a, const char* cstr) -{ - u64 cstr_size = CstrSize(cstr); - struct res_void cstr_res = arena_alloc(a, cstr_size); - u8 *str = (u8 *)cstr_res.memory; - u64 str_size = cstr_res.bytes_count; - - MemCopy((void*)str, (void*)cstr, str_size*sizeof(u8)); - - struct res_str8 result = {}; - result.string = Str8(str, str_size); - result.bytes_count = str_size; - return result; -} |