Fix comparison against nil for cstring
This commit is contained in:
1 parent
9da05dd4cb
commit
40542e6e26
2 files changed
+13
-2
No files matched your search
@@ -1,4 +1,5 @@
|
||||
import "core:mem.odin"
|
||||
import "core:raw.odin"
|
||||
|
||||
new_string :: proc(s: string) -> string {
|
||||
c := make([]byte, len(s)+1);
|
||||
@@ -19,6 +20,10 @@ to_odin_string :: proc(str: cstring) -> string {
|
||||
return string(str);
|
||||
}
|
||||
|
||||
string_from_ptr :: proc(ptr: ^byte, len: int) -> string {
|
||||
return transmute(string)raw.String{ptr, len};
|
||||
}
|
||||
|
||||
contains_rune :: proc(s: string, r: rune) -> int {
|
||||
for c, offset in s {
|
||||
if c == r do return offset;
|
||||
|
||||
Reference in new issue
Block a user