diff options
| author | gingerBill <bill@gingerbill.org> | 2020-03-04 22:09:58 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2020-03-04 22:09:58 +0000 |
| commit | e1da631d2620d87085f1a288e57ba39e1d7e92e5 (patch) | |
| tree | 9c80cab406f2d94f49f129838bba317c480cae12 /src/string.cpp | |
| parent | 6151fdb324714c0350f5c3731357cdf7243ade97 (diff) | |
General functionality without `context`
Diffstat (limited to 'src/string.cpp')
| -rw-r--r-- | src/string.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp index 9551821aa..724733ce7 100644 --- a/src/string.cpp +++ b/src/string.cpp @@ -101,6 +101,14 @@ char *alloc_cstring(gbAllocator a, String s) { return c_str; } +char *cstring_duplicate(gbAllocator a, char const *s) { + isize len = gb_strlen(s); + char *c_str = gb_alloc_array(a, char, len+1); + gb_memmove(c_str, s, len); + c_str[len] = '\0'; + return c_str; +} + gb_inline bool str_eq_ignore_case(String const &a, String const &b) { |