buffer is a pointer

This commit is contained in:
Motiejus Jakštys 2022-02-19 22:10:55 +02:00 committed by Motiejus Jakštys
parent ae2d3d5443
commit 4dbc7b03bc

View File

@ -34,10 +34,10 @@ pub const UserWriter = struct {
// function makes tests easier, and removes the Shell dependency of this // function makes tests easier, and removes the Shell dependency of this
// module. // module.
const shellIndexFnType = fn ([]const u8) ?u6; const shellIndexFnType = fn ([]const u8) ?u6;
appendTo: ArrayList(u8), appendTo: *ArrayList(u8),
shellIndexFn: shellIndexFnType, shellIndexFn: shellIndexFnType,
pub fn init(appendTo: ArrayList(u8), shellIndexFn: shellIndexFnType) UserWriter { pub fn init(appendTo: *ArrayList(u8), shellIndexFn: shellIndexFnType) UserWriter {
return UserWriter{ return UserWriter{
.appendTo = appendTo, .appendTo = appendTo,
.shellIndexFn = shellIndexFn, .shellIndexFn = shellIndexFn,
@ -98,7 +98,7 @@ test "construct PackedUser blob" {
var buf = ArrayList(u8).init(testing.allocator); var buf = ArrayList(u8).init(testing.allocator);
defer buf.deinit(); defer buf.deinit();
var writer = UserWriter.init(buf, testShellIndex); var writer = UserWriter.init(&buf, testShellIndex);
const user1 = User{ const user1 = User{
.uid = 1000, .uid = 1000,
.gid = 1000, .gid = 1000,