authorgravatar for isaachier@gmail.comisaachier <isaachier@gmail.com> 2018-06-06 14:09:47-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-06 14:09:47-04:00
log4fc601895b9f89bf0d3d3c1de1b0bbc959444298
tree2a640978cf8964cb78fc0395843ac3c5843fb860
parente7f141b3762b9b6c07e17cfa68f9d4c3fd02aba2

Fix const-ness of buffer in replaceContents method (#1065)


1 files changed, 1 insertions(+), 2 deletions(-)

std/buffer.zig+1-2
...@@ -28,7 +28,6 @@ pub const Buffer = struct {...@@ -28,7 +28,6 @@ pub const Buffer = struct {
28 /// Must deinitialize with deinit.28 /// Must deinitialize with deinit.
29 /// None of the other operations are valid until you do one of these:29 /// None of the other operations are valid until you do one of these:
30 /// * ::replaceContents30 /// * ::replaceContents
31 /// * ::replaceContentsBuffer
32 /// * ::resize31 /// * ::resize
33 pub fn initNull(allocator: *Allocator) Buffer {32 pub fn initNull(allocator: *Allocator) Buffer {
34 return Buffer{ .list = ArrayList(u8).init(allocator) };33 return Buffer{ .list = ArrayList(u8).init(allocator) };
...@@ -116,7 +115,7 @@ pub const Buffer = struct {...@@ -116,7 +115,7 @@ pub const Buffer = struct {
116 return mem.eql(u8, self.list.items[start..l], m);115 return mem.eql(u8, self.list.items[start..l], m);
117 }116 }
118117
119 pub fn replaceContents(self: *const Buffer, m: []const u8) !void {118 pub fn replaceContents(self: *Buffer, m: []const u8) !void {
120 try self.resize(m.len);119 try self.resize(m.len);
121 mem.copy(u8, self.list.toSlice(), m);120 mem.copy(u8, self.list.toSlice(), m);
122 }121 }