aboutsummaryrefslogtreecommitdiff
path: root/lib/std/cstr.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2020-02-14 10:27:44 -0500
committerAndrew Kelley <andrew@ziglang.org>2020-02-14 10:27:44 -0500
commita8b36fbe34e4acfea1fcb348fbed321b05611fd3 (patch)
tree23f489f85c427a003577f5c40b74201ba8c85ddb /lib/std/cstr.zig
parentcdc5070f216a924d24588b8d0fe06400e036e6bf (diff)
parent40b9db7cad6f876bb3e8fa32d7b32bbd4bc983ea (diff)
downloadzig-a8b36fbe34e4acfea1fcb348fbed321b05611fd3.tar.gz
zig-a8b36fbe34e4acfea1fcb348fbed321b05611fd3.zip
Merge remote-tracking branch 'origin/master' into llvm10
Diffstat (limited to 'lib/std/cstr.zig')
-rw-r--r--lib/std/cstr.zig5
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/std/cstr.zig b/lib/std/cstr.zig
index 5194dc1a13..5d16e9387b 100644
--- a/lib/std/cstr.zig
+++ b/lib/std/cstr.zig
@@ -41,9 +41,8 @@ pub fn addNullByte(allocator: *mem.Allocator, slice: []const u8) ![:0]u8 {
}
test "addNullByte" {
- var buf: [30]u8 = undefined;
- const allocator = &std.heap.FixedBufferAllocator.init(&buf).allocator;
- const slice = try addNullByte(allocator, "hello"[0..4]);
+ const slice = try addNullByte(std.testing.allocator, "hello"[0..4]);
+ defer std.testing.allocator.free(slice);
testing.expect(slice.len == 4);
testing.expect(slice[4] == 0);
}