use buffered reader

This commit is contained in:
Motiejus Jakštys 2022-07-04 22:49:26 +03:00
parent c00b8b7f9f
commit 1546871e2d

View File

@ -79,14 +79,16 @@ fn execute(
return fail(errc.wrapf("open '{s}'", .{groupFname}), stderr, err);
defer groupFile.close();
var users = User.fromReader(allocator, &errc, passwdFile.reader()) catch |err|
var passwdReader = io.bufferedReader(passwdFile.reader()).reader();
var users = User.fromReader(allocator, &errc, passwdReader) catch |err|
return fail(errc.wrap("read users"), stderr, err);
defer {
for (users) |*user| user.deinit(allocator);
allocator.free(users);
}
var groups = Group.fromReader(allocator, groupFile.reader()) catch |err|
var groupReader = io.bufferedReader(groupFile.reader()).reader();
var groups = Group.fromReader(allocator, groupReader) catch |err|
return fail(errc.wrap("read groups"), stderr, err);
defer {
for (groups) |*group| group.deinit(allocator);