diff options
| author | gingerBill <gingerBill@users.noreply.github.com> | 2020-03-26 17:41:38 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-26 17:41:38 +0000 |
| commit | 6bbecbe895a7b413dee61da772586be4e3138174 (patch) | |
| tree | a86e716cb2a519a7bff7a320821fbde7abd8673e /src/string.cpp | |
| parent | 7909872877fd5c82c29df711f160838a7a4e59e1 (diff) | |
| parent | b21993a1c470a533a83e5b01274d3b026fb34f9b (diff) | |
Merge pull request #595 from odin-lang/llvm-integration
LLVM C API Integration
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) { |