aboutsummaryrefslogtreecommitdiff
path: root/core/strings
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2019-12-01 18:06:49 +0000
committergingerBill <bill@gingerbill.org>2019-12-01 18:06:49 +0000
commit6b5ea011e76de3f82ca2b88e1b86161e98448ae8 (patch)
treef1e66318051a95dc3231607eb6c5266d7fe1b907 /core/strings
parent9503440eb06d2951195425aad10d6aea25083970 (diff)
Add `strings.ptr_from_string`
Diffstat (limited to 'core/strings')
-rw-r--r--core/strings/strings.odin4
1 files changed, 4 insertions, 0 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin
index e84094914..6e004993a 100644
--- a/core/strings/strings.odin
+++ b/core/strings/strings.odin
@@ -42,6 +42,10 @@ string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
return transmute(string)mem.Raw_String{ptr, len};
}
+ptr_from_string :: proc(str: string) -> ^byte {
+ d := transmute(mem.Raw_String)str;
+ return d.data;
+}
unsafe_string_to_cstring :: proc(str: string) -> cstring {
d := transmute(mem.Raw_String)str;