Remove the hidden NUL byte past the end from strings.clone
This commit is contained in:
1 parent
43763ddfda
commit
f364ac60c2
1 file changed
+1
-2
@@ -6,9 +6,8 @@ import "core:unicode"
|
|||||||
import "core:unicode/utf8"
|
import "core:unicode/utf8"
|
||||||
|
|
||||||
clone :: proc(s: string, allocator := context.allocator, loc := #caller_location) -> string {
|
clone :: proc(s: string, allocator := context.allocator, loc := #caller_location) -> string {
|
||||||
c := make([]byte, len(s)+1, allocator, loc)
|
c := make([]byte, len(s), allocator, loc)
|
||||||
copy(c, s)
|
copy(c, s)
|
||||||
c[len(s)] = 0
|
|
||||||
return string(c[:len(s)])
|
return string(c[:len(s)])
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user