From f364ac60c290790e7df82c5f6ed9bf79824c223c Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sat, 1 Jan 2022 15:31:51 +0000 Subject: [PATCH] Remove the hidden NUL byte past the end from `strings.clone` --- core/strings/strings.odin | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 3f703372f..b93c5bcc0 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -6,9 +6,8 @@ import "core:unicode" import "core:unicode/utf8" 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) - c[len(s)] = 0 return string(c[:len(s)]) }