From 24c2ff5caea15d3d6953414cd4a984993e8fa36e Mon Sep 17 00:00:00 2001 From: Josh Wolfe Date: Tue, 16 Jan 2018 13:45:34 -0700 Subject: Revert "Buffer.toSliceCopy" This reverts commit c58f5a4742156c09e215533ae274f9f991e287a7. --- std/buffer.zig | 19 ------------------- 1 file changed, 19 deletions(-) (limited to 'std/buffer.zig') diff --git a/std/buffer.zig b/std/buffer.zig index 9c968823b6..be69eafcfe 100644 --- a/std/buffer.zig +++ b/std/buffer.zig @@ -146,16 +146,6 @@ pub const Buffer = struct { pub fn ptr(self: &const Buffer) -> &u8 { return self.list.items.ptr; } - - /// Returns a copy of this buffer's toSlice() contents - /// allocated exactly to size. - /// This method uses the provided allocator instead of - /// this object's own allocator to allocate the new array. - pub fn toSliceCopy(self: &Buffer, allocator: &Allocator) -> %[]u8 { - var result = try allocator.alloc(u8, self.len()); - mem.copy(u8, result, self.toSliceConst()); - return result; - } }; test "simple Buffer" { @@ -178,12 +168,3 @@ test "simple Buffer" { try buf2.resize(4); assert(buf.startsWith(buf2.toSliceConst())); } - -test "Buffer.toSliceCopy" { - var buffer = try Buffer.init(debug.global_allocator, "abc"); - var copy = try buffer.toSliceCopy(debug.global_allocator); - buffer.shrink(0); - try buffer.append("xyz"); - assert(mem.eql(u8, buffer.toSliceConst(), "xyz")); - assert(mem.eql(u8, copy, "abc")); -} -- cgit v1.2.3