zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 4fc601895b9f89bf0d3d3c1de1b0bbc959444298 (tree)
parent e7f141b3762b9b6c07e17cfa68f9d4c3fd02aba2
Author: isaachier <isaachier@gmail.com>
Date:   Wed,  6 Jun 2018 14:09:47 -0400

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


Diffstat:
Mstd/buffer.zig | 3+--
1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/std/buffer.zig b/std/buffer.zig @@ -28,7 +28,6 @@ pub const Buffer = struct { /// Must deinitialize with deinit. /// None of the other operations are valid until you do one of these: /// * ::replaceContents - /// * ::replaceContentsBuffer /// * ::resize pub fn initNull(allocator: *Allocator) Buffer { return Buffer{ .list = ArrayList(u8).init(allocator) }; @@ -116,7 +115,7 @@ pub const Buffer = struct { return mem.eql(u8, self.list.items[start..l], m); } - pub fn replaceContents(self: *const Buffer, m: []const u8) !void { + pub fn replaceContents(self: *Buffer, m: []const u8) !void { try self.resize(m.len); mem.copy(u8, self.list.toSlice(), m); }