use buffered reader
This commit is contained in:
parent
c00b8b7f9f
commit
1546871e2d
@ -79,14 +79,16 @@ fn execute(
|
|||||||
return fail(errc.wrapf("open '{s}'", .{groupFname}), stderr, err);
|
return fail(errc.wrapf("open '{s}'", .{groupFname}), stderr, err);
|
||||||
defer groupFile.close();
|
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);
|
return fail(errc.wrap("read users"), stderr, err);
|
||||||
defer {
|
defer {
|
||||||
for (users) |*user| user.deinit(allocator);
|
for (users) |*user| user.deinit(allocator);
|
||||||
allocator.free(users);
|
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);
|
return fail(errc.wrap("read groups"), stderr, err);
|
||||||
defer {
|
defer {
|
||||||
for (groups) |*group| group.deinit(allocator);
|
for (groups) |*group| group.deinit(allocator);
|
||||||
|
Loading…
Reference in New Issue
Block a user