Skip to content

Commit 256c593

Browse files
committed
std.tar: remove abuse of inline fn
In general, any `inline fn` should document why it is using `inline` because the rule of thumb is: don't use inline.
1 parent 30f15e3 commit 256c593

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

lib/std/tar.zig

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,14 +299,14 @@ fn Iterator(comptime ReaderType: type) type {
299299
return header;
300300
}
301301

302-
inline fn readString(self: *Self, size: usize, buffer: []u8) ![]const u8 {
302+
fn readString(self: *Self, size: usize, buffer: []u8) ![]const u8 {
303303
if (size > buffer.len) return error.TarCorruptInput;
304304
const buf = buffer[0..size];
305305
try self.reader.readNoEof(buf);
306306
return nullStr(buf);
307307
}
308308

309-
inline fn initFile(self: *Self) void {
309+
fn initFile(self: *Self) void {
310310
self.file = File{
311311
.name = self.file_name_buffer[0..0],
312312
.link_name = self.link_name_buffer[0..0],
@@ -318,7 +318,7 @@ fn Iterator(comptime ReaderType: type) type {
318318
}
319319

320320
// Number of padding bytes in the last file block.
321-
inline fn blockPadding(size: u64) usize {
321+
fn blockPadding(size: u64) usize {
322322
const block_rounded = std.mem.alignForward(u64, size, Header.SIZE); // size rounded to te block boundary
323323
return @intCast(block_rounded - size);
324324
}
@@ -498,22 +498,22 @@ fn PaxIterator(comptime ReaderType: type) type {
498498
return null;
499499
}
500500

501-
inline fn readUntil(self: *Self, delimiter: u8) ![]const u8 {
501+
fn readUntil(self: *Self, delimiter: u8) ![]const u8 {
502502
var fbs = std.io.fixedBufferStream(&self.scratch);
503503
try self.reader.streamUntilDelimiter(fbs.writer(), delimiter, null);
504504
return fbs.getWritten();
505505
}
506506

507-
inline fn eql(a: []const u8, b: []const u8) bool {
507+
fn eql(a: []const u8, b: []const u8) bool {
508508
return std.mem.eql(u8, a, b);
509509
}
510510

511-
inline fn hasNull(str: []const u8) bool {
511+
fn hasNull(str: []const u8) bool {
512512
return (std.mem.indexOfScalar(u8, str, 0)) != null;
513513
}
514514

515515
// Checks that each record ends with new line.
516-
inline fn validateAttributeEnding(reader: ReaderType) !void {
516+
fn validateAttributeEnding(reader: ReaderType) !void {
517517
if (try reader.readByte() != '\n') return error.PaxInvalidAttributeEnd;
518518
}
519519
};

0 commit comments

Comments
 (0)