split -> splitScalar
This commit is contained in:
parent
4b649eb445
commit
5bd4d227db
|
@ -63,8 +63,8 @@ pub fn parse(self: Self, reader: anytype) !ParsedConfig {
|
|||
errdefer rc.deinit();
|
||||
while (try reader.readUntilDelimiterOrEofAlloc(self.allocator, '\n', std.math.maxInt(usize))) |line| {
|
||||
defer self.allocator.free(line);
|
||||
const nocomments = std.mem.trim(u8, @constCast(&std.mem.split(u8, line, "#")).first(), ws);
|
||||
var data_iterator = std.mem.split(u8, nocomments, "=");
|
||||
const nocomments = std.mem.trim(u8, @constCast(&std.mem.splitScalar(u8, line, '#')).first(), ws);
|
||||
var data_iterator = std.mem.splitScalar(u8, nocomments, '=');
|
||||
const key = std.mem.trim(u8, data_iterator.first(), ws); // first never fails
|
||||
if (key.len == 0) continue;
|
||||
const value = std.mem.trim(u8, data_iterator.next() orelse return error.NoValueForKey, ws);
|
||||
|
|
|
@ -207,7 +207,7 @@ fn executorIsMatch(match_data: []const u8, requested_path: []const u8, headers:
|
|||
};
|
||||
// Apparently std.mem.split will return an empty first when the haystack starts
|
||||
// with the delimiter
|
||||
var split = std.mem.split(u8, std.mem.trim(u8, match_data[colon + 1 ..], "\t "), " ");
|
||||
var split = std.mem.splitScalar(u8, std.mem.trim(u8, match_data[colon + 1 ..], "\t "), ' ');
|
||||
const header_value_needle = split.first();
|
||||
const path_needle = split.next() orelse {
|
||||
std.log.warn(
|
||||
|
|
Loading…
Reference in New Issue
Block a user