Browse Source

Remove the hidden NUL byte past the end from `bytes.clone`

gingerBill 3 years ago
parent
commit
a032a2ef32
1 changed files with 1 additions and 2 deletions
  1. 1 2
      core/bytes/bytes.odin

+ 1 - 2
core/bytes/bytes.odin

@@ -5,9 +5,8 @@ import "core:unicode"
 import "core:unicode/utf8"
 import "core:unicode/utf8"
 
 
 clone :: proc(s: []byte, allocator := context.allocator, loc := #caller_location) -> []byte {
 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)
 	copy(c, s)
-	c[len(s)] = 0
 	return c[:len(s)]
 	return c[:len(s)]
 }
 }