aboutsummaryrefslogtreecommitdiff
path: root/src/string.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-05-26 23:12:55 +0100
committergingerBill <bill@gingerbill.org>2018-05-26 23:12:55 +0100
commitc067b90403ab8493daa0bf5867b2bd92319feea5 (patch)
treef8d8162cc7d0e937c925ed8b07831ffc0e9c75de /src/string.cpp
parent5b6770f3d297c0639bdbe8b1b029616c16669165 (diff)
Add basic package support (no IR support yet)
Diffstat (limited to 'src/string.cpp')
-rw-r--r--src/string.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/string.cpp b/src/string.cpp
index 16ba3c951..b63de5c76 100644
--- a/src/string.cpp
+++ b/src/string.cpp
@@ -94,6 +94,13 @@ String substring(String const &s, isize lo, isize hi) {
}
+char *alloc_cstring(gbAllocator a, String s) {
+ char *c_str = gb_alloc_array(a, char, s.len+1);
+ gb_memcopy(c_str, s.text, s.len);
+ c_str[s.len] = '\0';
+ return c_str;
+}
+
gb_inline bool str_eq_ignore_case(String const &a, String const &b) {