diff options
| author | gingerBill <bill@gingerbill.org> | 2018-12-26 19:38:05 +0000 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2018-12-26 19:38:05 +0000 |
| commit | b2d40680c8f50f6ab932ae559bfaac83f7131ab9 (patch) | |
| tree | c2af0ecab50e8bc29d66d49f9e64527d4c8f755e /core/strings | |
| parent | 8662df2b7fa6a45cd81941357a2fe96854b05336 (diff) | |
Fix `join` and `concatenate` to use the supplied allocator
Diffstat (limited to 'core/strings')
| -rw-r--r-- | core/strings/strings.odin | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/strings/strings.odin b/core/strings/strings.odin index 20c4beb2b..9d9082b62 100644 --- a/core/strings/strings.odin +++ b/core/strings/strings.odin @@ -103,7 +103,7 @@ join :: proc(a: []string, sep: string, allocator := context.allocator) -> string n += len(s); } - b := make([]byte, n); + b := make([]byte, n, allocator); i := copy(b, cast([]byte)a[0]); for s in a[1:] { i += copy(b[i:], cast([]byte)sep); @@ -121,7 +121,7 @@ concatenate :: proc(a: []string, allocator := context.allocator) -> string { for s in a { n += len(s); } - b := make([]byte, n); + b := make([]byte, n, allocator); i := 0; for s in a { i += copy(b[i:], cast([]byte)s); |