A poolable string builder (aka string buffer) for Zig
0

Configure Feed

Select the types of activity you want to include in your feed.

use @memcpy

Karl Seguin (Aug 4, 2023, 3:52 PM +0800) a88b6040 58207904

+2 -2
+2 -2
src/buffer.zig
··· 59 59 pub fn write(self: *View, data: []const u8) void { 60 60 const pos = self.pos; 61 61 const end_pos = pos + data.len; 62 - std.mem.copyForwards(u8, self.buf[pos..end_pos], data); 62 + @memcpy(self.buf[pos..end_pos], data); 63 63 self.pos = end_pos; 64 64 } 65 65 ··· 262 262 const allocator = self._da orelse self._a; 263 263 if (buf.ptr == self.static.ptr or !allocator.resize(buf, new_capacity)) { 264 264 const new_buffer = try allocator.alloc(u8, new_capacity); 265 - std.mem.copyForwards(u8, new_buffer[0..buf.len], buf); 265 + @memcpy(new_buffer[0..buf.len], buf); 266 266 267 267 if (self.dynamic) |dyn| { 268 268 allocator.free(dyn);