Skip to content

Commit 24c2ff5

Browse files
committedJan 16, 2018
Revert "Buffer.toSliceCopy"
This reverts commit c58f5a4.
1 parent c58f5a4 commit 24c2ff5

File tree

1 file changed

+0
-19
lines changed

1 file changed

+0
-19
lines changed
 

‎std/buffer.zig

-19
Original file line numberDiff line numberDiff line change
@@ -146,16 +146,6 @@ pub const Buffer = struct {
146146
pub fn ptr(self: &const Buffer) -> &u8 {
147147
return self.list.items.ptr;
148148
}
149-
150-
/// Returns a copy of this buffer's toSlice() contents
151-
/// allocated exactly to size.
152-
/// This method uses the provided allocator instead of
153-
/// this object's own allocator to allocate the new array.
154-
pub fn toSliceCopy(self: &Buffer, allocator: &Allocator) -> %[]u8 {
155-
var result = try allocator.alloc(u8, self.len());
156-
mem.copy(u8, result, self.toSliceConst());
157-
return result;
158-
}
159149
};
160150

161151
test "simple Buffer" {
@@ -178,12 +168,3 @@ test "simple Buffer" {
178168
try buf2.resize(4);
179169
assert(buf.startsWith(buf2.toSliceConst()));
180170
}
181-
182-
test "Buffer.toSliceCopy" {
183-
var buffer = try Buffer.init(debug.global_allocator, "abc");
184-
var copy = try buffer.toSliceCopy(debug.global_allocator);
185-
buffer.shrink(0);
186-
try buffer.append("xyz");
187-
assert(mem.eql(u8, buffer.toSliceConst(), "xyz"));
188-
assert(mem.eql(u8, copy, "abc"));
189-
}

0 commit comments

Comments
 (0)
Please sign in to comment.