diff options
| author | gingerBill <bill@gingerbill.org> | 2022-01-01 15:33:19 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-01-01 15:33:19 +0000 |
| commit | a032a2ef322de150587117396eaf6e5ae7a11768 (patch) | |
| tree | b432c06f055fb318151e0e7e8d28166d84bf88cf | |
| parent | f364ac60c290790e7df82c5f6ed9bf79824c223c (diff) | |
Remove the hidden NUL byte past the end from `bytes.clone`
| -rw-r--r-- | core/bytes/bytes.odin | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/core/bytes/bytes.odin b/core/bytes/bytes.odin index 1e83b93c8..1bf11e0b0 100644 --- a/core/bytes/bytes.odin +++ b/core/bytes/bytes.odin @@ -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)] } |