split -> splitScalar
Some checks failed
Build / build (push) Successful in 46s
Build / sign (push) Failing after 47s
Build / deploy (push) Successful in 58s

This commit is contained in:
Emil Lerch 2024-10-15 14:52:54 -07:00
parent 4b649eb445
commit 5bd4d227db
Signed by: lobo
GPG Key ID: A7B62D657EF764F8
2 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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(