mirror of
https://github.com/ziglang/zig.git
synced 2026-02-15 13:58:27 +00:00
Fix const-ness of buffer in replaceContents method (#1065)
This commit is contained in:
parent
e7f141b376
commit
4fc601895b
@ -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);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user