mirror of
https://github.com/odin-lang/Odin.git
synced 2026-01-08 05:53:12 +00:00
Remove the hidden NUL byte past the end from bytes.clone
This commit is contained in:
@@ -5,9 +5,8 @@ import "core:unicode"
|
||||
import "core:unicode/utf8"
|
||||
|
||||
clone :: proc(s: []byte, allocator := context.allocator, loc := #caller_location) -> []byte {
|
||||
c := make([]byte, len(s)+1, allocator, loc)
|
||||
c := make([]byte, len(s), allocator, loc)
|
||||
copy(c, s)
|
||||
c[len(s)] = 0
|
||||
return c[:len(s)]
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user