authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-05-04 18:05:40-07:00
committergravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-05-13 13:45:04-07:00
log815e53b147a321d0bdb47dc008aa8181f57175ac
treedc4b4107c3fa8a50032d6d916a57a1718a445fc9
parentce9f3ec990cd556f2a9d06a6db2bb53e97a61172

Update all std.mem.tokenize calls to their appropriate function

Everywhere that can now use `tokenizeScalar` should get a nice little performance boost.

24 files changed, 79 insertions(+), 79 deletions(-)

build.zig+4-4
...@@ -284,7 +284,7 @@ pub fn build(b: *std.Build) !void {...@@ -284,7 +284,7 @@ pub fn build(b: *std.Build) !void {
284 // That means we also have to rely on stage1 compiled c++ files. We parse config.h to find284 // That means we also have to rely on stage1 compiled c++ files. We parse config.h to find
285 // the information passed on to us from cmake.285 // the information passed on to us from cmake.
286 if (cfg.cmake_prefix_path.len > 0) {286 if (cfg.cmake_prefix_path.len > 0) {
287 var it = mem.tokenize(u8, cfg.cmake_prefix_path, ";");287 var it = mem.tokenizeScalar(u8, cfg.cmake_prefix_path, ';');
288 while (it.next()) |path| {288 while (it.next()) |path| {
289 b.addSearchPrefix(path);289 b.addSearchPrefix(path);
290 }290 }
...@@ -687,7 +687,7 @@ fn addCxxKnownPath(...@@ -687,7 +687,7 @@ fn addCxxKnownPath(
687 if (!std.process.can_spawn)687 if (!std.process.can_spawn)
688 return error.RequiredLibraryNotFound;688 return error.RequiredLibraryNotFound;
689 const path_padded = b.exec(&.{ ctx.cxx_compiler, b.fmt("-print-file-name={s}", .{objname}) });689 const path_padded = b.exec(&.{ ctx.cxx_compiler, b.fmt("-print-file-name={s}", .{objname}) });
690 var tokenizer = mem.tokenize(u8, path_padded, "\r\n");690 var tokenizer = mem.tokenizeAny(u8, path_padded, "\r\n");
691 const path_unpadded = tokenizer.next().?;691 const path_unpadded = tokenizer.next().?;
692 if (mem.eql(u8, path_unpadded, objname)) {692 if (mem.eql(u8, path_unpadded, objname)) {
693 if (errtxt) |msg| {693 if (errtxt) |msg| {
...@@ -710,7 +710,7 @@ fn addCxxKnownPath(...@@ -710,7 +710,7 @@ fn addCxxKnownPath(
710}710}
711711
712fn addCMakeLibraryList(exe: *std.Build.Step.Compile, list: []const u8) void {712fn addCMakeLibraryList(exe: *std.Build.Step.Compile, list: []const u8) void {
713 var it = mem.tokenize(u8, list, ";");713 var it = mem.tokenizeScalar(u8, list, ';');
714 while (it.next()) |lib| {714 while (it.next()) |lib| {
715 if (mem.startsWith(u8, lib, "-l")) {715 if (mem.startsWith(u8, lib, "-l")) {
716 exe.linkSystemLibrary(lib["-l".len..]);716 exe.linkSystemLibrary(lib["-l".len..]);
...@@ -855,7 +855,7 @@ fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {...@@ -855,7 +855,7 @@ fn parseConfigH(b: *std.Build, config_h_text: []const u8) ?CMakeConfig {
855 // .prefix = ZIG_LLVM_LINK_MODE parsed manually below855 // .prefix = ZIG_LLVM_LINK_MODE parsed manually below
856 };856 };
857857
858 var lines_it = mem.tokenize(u8, config_h_text, "\r\n");858 var lines_it = mem.tokenizeAny(u8, config_h_text, "\r\n");
859 while (lines_it.next()) |line| {859 while (lines_it.next()) |line| {
860 inline for (mappings) |mapping| {860 inline for (mappings) |mapping| {
861 if (mem.startsWith(u8, line, mapping.prefix)) {861 if (mem.startsWith(u8, line, mapping.prefix)) {
lib/std/Build.zig+1-1
...@@ -1358,7 +1358,7 @@ pub fn findProgram(self: *Build, names: []const []const u8, paths: []const []con...@@ -1358,7 +1358,7 @@ pub fn findProgram(self: *Build, names: []const []const u8, paths: []const []con
1358 if (fs.path.isAbsolute(name)) {1358 if (fs.path.isAbsolute(name)) {
1359 return name;1359 return name;
1360 }1360 }
1361 var it = mem.tokenize(u8, PATH, &[_]u8{fs.path.delimiter});1361 var it = mem.tokenizeScalar(u8, PATH, fs.path.delimiter);
1362 while (it.next()) |path| {1362 while (it.next()) |path| {
1363 const full_path = self.pathJoin(&.{1363 const full_path = self.pathJoin(&.{
1364 path,1364 path,
lib/std/Build/Cache.zig+2-2
...@@ -434,7 +434,7 @@ pub const Manifest = struct {...@@ -434,7 +434,7 @@ pub const Manifest = struct {
434434
435 const input_file_count = self.files.items.len;435 const input_file_count = self.files.items.len;
436 var any_file_changed = false;436 var any_file_changed = false;
437 var line_iter = mem.tokenize(u8, file_contents, "\n");437 var line_iter = mem.tokenizeScalar(u8, file_contents, '\n');
438 var idx: usize = 0;438 var idx: usize = 0;
439 if (if (line_iter.next()) |line| !std.mem.eql(u8, line, manifest_header) else true) {439 if (if (line_iter.next()) |line| !std.mem.eql(u8, line, manifest_header) else true) {
440 if (try self.upgradeToExclusiveLock()) continue;440 if (try self.upgradeToExclusiveLock()) continue;
...@@ -463,7 +463,7 @@ pub const Manifest = struct {...@@ -463,7 +463,7 @@ pub const Manifest = struct {
463 break :blk new;463 break :blk new;
464 };464 };
465465
466 var iter = mem.tokenize(u8, line, " ");466 var iter = mem.tokenizeScalar(u8, line, ' ');
467 const size = iter.next() orelse return error.InvalidFormat;467 const size = iter.next() orelse return error.InvalidFormat;
468 const inode = iter.next() orelse return error.InvalidFormat;468 const inode = iter.next() orelse return error.InvalidFormat;
469 const mtime_nsec_str = iter.next() orelse return error.InvalidFormat;469 const mtime_nsec_str = iter.next() orelse return error.InvalidFormat;
lib/std/Build/Step/CheckObject.zig+4-4
...@@ -103,8 +103,8 @@ const Action = struct {...@@ -103,8 +103,8 @@ const Action = struct {
103 assert(act.tag == .match or act.tag == .not_present);103 assert(act.tag == .match or act.tag == .not_present);
104 const phrase = act.phrase.resolve(b, step);104 const phrase = act.phrase.resolve(b, step);
105 var candidate_var: ?struct { name: []const u8, value: u64 } = null;105 var candidate_var: ?struct { name: []const u8, value: u64 } = null;
106 var hay_it = mem.tokenize(u8, mem.trim(u8, haystack, " "), " ");106 var hay_it = mem.tokenizeScalar(u8, mem.trim(u8, haystack, " "), ' ');
107 var needle_it = mem.tokenize(u8, mem.trim(u8, phrase, " "), " ");107 var needle_it = mem.tokenizeScalar(u8, mem.trim(u8, phrase, " "), ' ');
108108
109 while (needle_it.next()) |needle_tok| {109 while (needle_it.next()) |needle_tok| {
110 const hay_tok = hay_it.next() orelse return false;110 const hay_tok = hay_it.next() orelse return false;
...@@ -155,7 +155,7 @@ const Action = struct {...@@ -155,7 +155,7 @@ const Action = struct {
155 var op_stack = std.ArrayList(enum { add, sub, mod, mul }).init(gpa);155 var op_stack = std.ArrayList(enum { add, sub, mod, mul }).init(gpa);
156 var values = std.ArrayList(u64).init(gpa);156 var values = std.ArrayList(u64).init(gpa);
157157
158 var it = mem.tokenize(u8, phrase, " ");158 var it = mem.tokenizeScalar(u8, phrase, ' ');
159 while (it.next()) |next| {159 while (it.next()) |next| {
160 if (mem.eql(u8, next, "+")) {160 if (mem.eql(u8, next, "+")) {
161 try op_stack.append(.add);161 try op_stack.append(.add);
...@@ -365,7 +365,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {...@@ -365,7 +365,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
365 var vars = std.StringHashMap(u64).init(gpa);365 var vars = std.StringHashMap(u64).init(gpa);
366366
367 for (self.checks.items) |chk| {367 for (self.checks.items) |chk| {
368 var it = mem.tokenize(u8, output, "\r\n");368 var it = mem.tokenizeAny(u8, output, "\r\n");
369 for (chk.actions.items) |act| {369 for (chk.actions.items) |act| {
370 switch (act.tag) {370 switch (act.tag) {
371 .match => {371 .match => {
lib/std/Build/Step/Compile.zig+3-3
...@@ -777,7 +777,7 @@ fn runPkgConfig(self: *Compile, lib_name: []const u8) ![]const []const u8 {...@@ -777,7 +777,7 @@ fn runPkgConfig(self: *Compile, lib_name: []const u8) ![]const []const u8 {
777 var zig_args = ArrayList([]const u8).init(b.allocator);777 var zig_args = ArrayList([]const u8).init(b.allocator);
778 defer zig_args.deinit();778 defer zig_args.deinit();
779779
780 var it = mem.tokenize(u8, stdout, " \r\n\t");780 var it = mem.tokenizeAny(u8, stdout, " \r\n\t");
781 while (it.next()) |tok| {781 while (it.next()) |tok| {
782 if (mem.eql(u8, tok, "-I")) {782 if (mem.eql(u8, tok, "-I")) {
783 const dir = it.next() orelse return error.PkgConfigInvalidOutput;783 const dir = it.next() orelse return error.PkgConfigInvalidOutput;
...@@ -2017,10 +2017,10 @@ fn execPkgConfigList(self: *std.Build, out_code: *u8) (PkgConfigError || ExecErr...@@ -2017,10 +2017,10 @@ fn execPkgConfigList(self: *std.Build, out_code: *u8) (PkgConfigError || ExecErr
2017 const stdout = try self.execAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);2017 const stdout = try self.execAllowFail(&[_][]const u8{ "pkg-config", "--list-all" }, out_code, .Ignore);
2018 var list = ArrayList(PkgConfigPkg).init(self.allocator);2018 var list = ArrayList(PkgConfigPkg).init(self.allocator);
2019 errdefer list.deinit();2019 errdefer list.deinit();
2020 var line_it = mem.tokenize(u8, stdout, "\r\n");2020 var line_it = mem.tokenizeAny(u8, stdout, "\r\n");
2021 while (line_it.next()) |line| {2021 while (line_it.next()) |line| {
2022 if (mem.trim(u8, line, " \t").len == 0) continue;2022 if (mem.trim(u8, line, " \t").len == 0) continue;
2023 var tok_it = mem.tokenize(u8, line, " \t");2023 var tok_it = mem.tokenizeAny(u8, line, " \t");
2024 try list.append(PkgConfigPkg{2024 try list.append(PkgConfigPkg{
2025 .name = tok_it.next() orelse return error.PkgConfigInvalidOutput,2025 .name = tok_it.next() orelse return error.PkgConfigInvalidOutput,
2026 .desc = tok_it.rest(),2026 .desc = tok_it.rest(),
lib/std/Build/Step/ConfigHeader.zig+2-2
...@@ -257,7 +257,7 @@ fn render_autoconf(...@@ -257,7 +257,7 @@ fn render_autoconf(
257 try output.appendSlice("\n");257 try output.appendSlice("\n");
258 continue;258 continue;
259 }259 }
260 var it = std.mem.tokenize(u8, line[1..], " \t\r");260 var it = std.mem.tokenizeAny(u8, line[1..], " \t\r");
261 const undef = it.next().?;261 const undef = it.next().?;
262 if (!std.mem.eql(u8, undef, "undef")) {262 if (!std.mem.eql(u8, undef, "undef")) {
263 try output.appendSlice(line);263 try output.appendSlice(line);
...@@ -304,7 +304,7 @@ fn render_cmake(...@@ -304,7 +304,7 @@ fn render_cmake(
304 try output.appendSlice("\n");304 try output.appendSlice("\n");
305 continue;305 continue;
306 }306 }
307 var it = std.mem.tokenize(u8, line[1..], " \t\r");307 var it = std.mem.tokenizeAny(u8, line[1..], " \t\r");
308 const cmakedefine = it.next().?;308 const cmakedefine = it.next().?;
309 if (!std.mem.eql(u8, cmakedefine, "cmakedefine") and309 if (!std.mem.eql(u8, cmakedefine, "cmakedefine") and
310 !std.mem.eql(u8, cmakedefine, "cmakedefine01"))310 !std.mem.eql(u8, cmakedefine, "cmakedefine01"))
lib/std/child_process.zig+2-2
...@@ -850,7 +850,7 @@ pub const ChildProcess = struct {...@@ -850,7 +850,7 @@ pub const ChildProcess = struct {
850 return original_err;850 return original_err;
851 }851 }
852852
853 var it = mem.tokenize(u16, PATH, &[_]u16{';'});853 var it = mem.tokenizeScalar(u16, PATH, ';');
854 while (it.next()) |search_path| {854 while (it.next()) |search_path| {
855 dir_buf.clearRetainingCapacity();855 dir_buf.clearRetainingCapacity();
856 try dir_buf.appendSlice(self.allocator, search_path);856 try dir_buf.appendSlice(self.allocator, search_path);
...@@ -1067,7 +1067,7 @@ fn windowsCreateProcessPathExt(...@@ -1067,7 +1067,7 @@ fn windowsCreateProcessPathExt(
1067 // Now we know that at least *a* file matching the wildcard exists, we can loop1067 // Now we know that at least *a* file matching the wildcard exists, we can loop
1068 // through PATHEXT in order and exec any that exist1068 // through PATHEXT in order and exec any that exist
10691069
1070 var ext_it = mem.tokenize(u16, pathext, &[_]u16{';'});1070 var ext_it = mem.tokenizeScalar(u16, pathext, ';');
1071 while (ext_it.next()) |ext| {1071 while (ext_it.next()) |ext| {
1072 if (!windowsCreateProcessSupportsExtension(ext)) continue;1072 if (!windowsCreateProcessSupportsExtension(ext)) continue;
10731073
lib/std/fs.zig+1-1
...@@ -3021,7 +3021,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {...@@ -3021,7 +3021,7 @@ pub fn selfExePath(out_buffer: []u8) SelfExePathError![]u8 {
3021 } else if (argv0.len != 0) {3021 } else if (argv0.len != 0) {
3022 // argv[0] is not empty (and not a path): search it inside PATH3022 // argv[0] is not empty (and not a path): search it inside PATH
3023 const PATH = std.os.getenvZ("PATH") orelse return error.FileNotFound;3023 const PATH = std.os.getenvZ("PATH") orelse return error.FileNotFound;
3024 var path_it = mem.tokenize(u8, PATH, &[_]u8{path.delimiter});3024 var path_it = mem.tokenizeScalar(u8, PATH, path.delimiter);
3025 while (path_it.next()) |a_path| {3025 while (path_it.next()) |a_path| {
3026 var resolved_path_buf: [MAX_PATH_BYTES - 1:0]u8 = undefined;3026 var resolved_path_buf: [MAX_PATH_BYTES - 1:0]u8 = undefined;
3027 const resolved_path = std.fmt.bufPrintZ(&resolved_path_buf, "{s}/{s}", .{3027 const resolved_path = std.fmt.bufPrintZ(&resolved_path_buf, "{s}/{s}", .{
lib/std/fs/path.zig+13-13
...@@ -358,7 +358,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {...@@ -358,7 +358,7 @@ pub fn windowsParsePath(path: []const u8) WindowsPath {
358 return relative_path;358 return relative_path;
359 }359 }
360360
361 var it = mem.tokenize(u8, path, &[_]u8{this_sep});361 var it = mem.tokenizeScalar(u8, path, this_sep);
362 _ = (it.next() orelse return relative_path);362 _ = (it.next() orelse return relative_path);
363 _ = (it.next() orelse return relative_path);363 _ = (it.next() orelse return relative_path);
364 return WindowsPath{364 return WindowsPath{
...@@ -420,8 +420,8 @@ fn networkShareServersEql(ns1: []const u8, ns2: []const u8) bool {...@@ -420,8 +420,8 @@ fn networkShareServersEql(ns1: []const u8, ns2: []const u8) bool {
420 const sep1 = ns1[0];420 const sep1 = ns1[0];
421 const sep2 = ns2[0];421 const sep2 = ns2[0];
422422
423 var it1 = mem.tokenize(u8, ns1, &[_]u8{sep1});423 var it1 = mem.tokenizeScalar(u8, ns1, sep1);
424 var it2 = mem.tokenize(u8, ns2, &[_]u8{sep2});424 var it2 = mem.tokenizeScalar(u8, ns2, sep2);
425425
426 // TODO ASCII is wrong, we actually need full unicode support to compare paths.426 // TODO ASCII is wrong, we actually need full unicode support to compare paths.
427 return ascii.eqlIgnoreCase(it1.next().?, it2.next().?);427 return ascii.eqlIgnoreCase(it1.next().?, it2.next().?);
...@@ -441,8 +441,8 @@ fn compareDiskDesignators(kind: WindowsPath.Kind, p1: []const u8, p2: []const u8...@@ -441,8 +441,8 @@ fn compareDiskDesignators(kind: WindowsPath.Kind, p1: []const u8, p2: []const u8
441 const sep1 = p1[0];441 const sep1 = p1[0];
442 const sep2 = p2[0];442 const sep2 = p2[0];
443443
444 var it1 = mem.tokenize(u8, p1, &[_]u8{sep1});444 var it1 = mem.tokenizeScalar(u8, p1, sep1);
445 var it2 = mem.tokenize(u8, p2, &[_]u8{sep2});445 var it2 = mem.tokenizeScalar(u8, p2, sep2);
446446
447 // TODO ASCII is wrong, we actually need full unicode support to compare paths.447 // TODO ASCII is wrong, we actually need full unicode support to compare paths.
448 return ascii.eqlIgnoreCase(it1.next().?, it2.next().?) and ascii.eqlIgnoreCase(it1.next().?, it2.next().?);448 return ascii.eqlIgnoreCase(it1.next().?, it2.next().?) and ascii.eqlIgnoreCase(it1.next().?, it2.next().?);
...@@ -535,7 +535,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 {...@@ -535,7 +535,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 {
535 break :l disk_designator.len;535 break :l disk_designator.len;
536 },536 },
537 .NetworkShare => {537 .NetworkShare => {
538 var it = mem.tokenize(u8, paths[first_index], "/\\");538 var it = mem.tokenizeAny(u8, paths[first_index], "/\\");
539 const server_name = it.next().?;539 const server_name = it.next().?;
540 const other_name = it.next().?;540 const other_name = it.next().?;
541541
...@@ -570,7 +570,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 {...@@ -570,7 +570,7 @@ pub fn resolveWindows(allocator: Allocator, paths: []const []const u8) ![]u8 {
570 if (!correct_disk_designator) {570 if (!correct_disk_designator) {
571 continue;571 continue;
572 }572 }
573 var it = mem.tokenize(u8, p[parsed.disk_designator.len..], "/\\");573 var it = mem.tokenizeAny(u8, p[parsed.disk_designator.len..], "/\\");
574 while (it.next()) |component| {574 while (it.next()) |component| {
575 if (mem.eql(u8, component, ".")) {575 if (mem.eql(u8, component, ".")) {
576 continue;576 continue;
...@@ -657,7 +657,7 @@ pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.E...@@ -657,7 +657,7 @@ pub fn resolvePosix(allocator: Allocator, paths: []const []const u8) Allocator.E
657 negative_count = 0;657 negative_count = 0;
658 result.clearRetainingCapacity();658 result.clearRetainingCapacity();
659 }659 }
660 var it = mem.tokenize(u8, p, "/");660 var it = mem.tokenizeScalar(u8, p, '/');
661 while (it.next()) |component| {661 while (it.next()) |component| {
662 if (mem.eql(u8, component, ".")) {662 if (mem.eql(u8, component, ".")) {
663 continue;663 continue;
...@@ -1078,8 +1078,8 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) !...@@ -1078,8 +1078,8 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) !
1078 return resolved_to;1078 return resolved_to;
1079 }1079 }
10801080
1081 var from_it = mem.tokenize(u8, resolved_from, "/\\");1081 var from_it = mem.tokenizeAny(u8, resolved_from, "/\\");
1082 var to_it = mem.tokenize(u8, resolved_to, "/\\");1082 var to_it = mem.tokenizeAny(u8, resolved_to, "/\\");
1083 while (true) {1083 while (true) {
1084 const from_component = from_it.next() orelse return allocator.dupe(u8, to_it.rest());1084 const from_component = from_it.next() orelse return allocator.dupe(u8, to_it.rest());
1085 const to_rest = to_it.rest();1085 const to_rest = to_it.rest();
...@@ -1102,7 +1102,7 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) !...@@ -1102,7 +1102,7 @@ pub fn relativeWindows(allocator: Allocator, from: []const u8, to: []const u8) !
1102 result_index += 3;1102 result_index += 3;
1103 }1103 }
11041104
1105 var rest_it = mem.tokenize(u8, to_rest, "/\\");1105 var rest_it = mem.tokenizeAny(u8, to_rest, "/\\");
1106 while (rest_it.next()) |to_component| {1106 while (rest_it.next()) |to_component| {
1107 result[result_index] = '\\';1107 result[result_index] = '\\';
1108 result_index += 1;1108 result_index += 1;
...@@ -1124,8 +1124,8 @@ pub fn relativePosix(allocator: Allocator, from: []const u8, to: []const u8) ![]...@@ -1124,8 +1124,8 @@ pub fn relativePosix(allocator: Allocator, from: []const u8, to: []const u8) ![]
1124 const resolved_to = try resolvePosix(allocator, &[_][]const u8{ cwd, to });1124 const resolved_to = try resolvePosix(allocator, &[_][]const u8{ cwd, to });
1125 defer allocator.free(resolved_to);1125 defer allocator.free(resolved_to);
11261126
1127 var from_it = mem.tokenize(u8, resolved_from, "/");1127 var from_it = mem.tokenizeScalar(u8, resolved_from, '/');
1128 var to_it = mem.tokenize(u8, resolved_to, "/");1128 var to_it = mem.tokenizeScalar(u8, resolved_to, '/');
1129 while (true) {1129 while (true) {
1130 const from_component = from_it.next() orelse return allocator.dupe(u8, to_it.rest());1130 const from_component = from_it.next() orelse return allocator.dupe(u8, to_it.rest());
1131 const to_rest = to_it.rest();1131 const to_rest = to_it.rest();
lib/std/http/Client.zig+2-2
...@@ -386,7 +386,7 @@ pub const Response = struct {...@@ -386,7 +386,7 @@ pub const Response = struct {
386 };386 };
387387
388 pub fn parse(res: *Response, bytes: []const u8, trailing: bool) ParseError!void {388 pub fn parse(res: *Response, bytes: []const u8, trailing: bool) ParseError!void {
389 var it = mem.tokenize(u8, bytes[0 .. bytes.len - 4], "\r\n");389 var it = mem.tokenizeAny(u8, bytes[0 .. bytes.len - 4], "\r\n");
390390
391 const first_line = it.next() orelse return error.HttpHeadersInvalid;391 const first_line = it.next() orelse return error.HttpHeadersInvalid;
392 if (first_line.len < 12)392 if (first_line.len < 12)
...@@ -412,7 +412,7 @@ pub const Response = struct {...@@ -412,7 +412,7 @@ pub const Response = struct {
412 else => {},412 else => {},
413 }413 }
414414
415 var line_it = mem.tokenize(u8, line, ": ");415 var line_it = mem.tokenizeAny(u8, line, ": ");
416 const header_name = line_it.next() orelse return error.HttpHeadersInvalid;416 const header_name = line_it.next() orelse return error.HttpHeadersInvalid;
417 const header_value = line_it.rest();417 const header_value = line_it.rest();
418418
lib/std/http/Server.zig+2-2
...@@ -231,7 +231,7 @@ pub const Request = struct {...@@ -231,7 +231,7 @@ pub const Request = struct {
231 };231 };
232232
233 pub fn parse(req: *Request, bytes: []const u8) ParseError!void {233 pub fn parse(req: *Request, bytes: []const u8) ParseError!void {
234 var it = mem.tokenize(u8, bytes[0 .. bytes.len - 4], "\r\n");234 var it = mem.tokenizeAny(u8, bytes[0 .. bytes.len - 4], "\r\n");
235235
236 const first_line = it.next() orelse return error.HttpHeadersInvalid;236 const first_line = it.next() orelse return error.HttpHeadersInvalid;
237 if (first_line.len < 10)237 if (first_line.len < 10)
...@@ -265,7 +265,7 @@ pub const Request = struct {...@@ -265,7 +265,7 @@ pub const Request = struct {
265 else => {},265 else => {},
266 }266 }
267267
268 var line_it = mem.tokenize(u8, line, ": ");268 var line_it = mem.tokenizeAny(u8, line, ": ");
269 const header_name = line_it.next() orelse return error.HttpHeadersInvalid;269 const header_name = line_it.next() orelse return error.HttpHeadersInvalid;
270 const header_value = line_it.rest();270 const header_value = line_it.rest();
271271
lib/std/net.zig+3-3
...@@ -1266,7 +1266,7 @@ fn linuxLookupNameFromHosts(...@@ -1266,7 +1266,7 @@ fn linuxLookupNameFromHosts(
1266 var split_it = mem.split(u8, line, "#");1266 var split_it = mem.split(u8, line, "#");
1267 const no_comment_line = split_it.first();1267 const no_comment_line = split_it.first();
12681268
1269 var line_it = mem.tokenize(u8, no_comment_line, " \t");1269 var line_it = mem.tokenizeAny(u8, no_comment_line, " \t");
1270 const ip_text = line_it.next() orelse continue;1270 const ip_text = line_it.next() orelse continue;
1271 var first_name_text: ?[]const u8 = null;1271 var first_name_text: ?[]const u8 = null;
1272 while (line_it.next()) |name_text| {1272 while (line_it.next()) |name_text| {
...@@ -1346,7 +1346,7 @@ fn linuxLookupNameFromDnsSearch(...@@ -1346,7 +1346,7 @@ fn linuxLookupNameFromDnsSearch(
1346 @memcpy(canon.items, canon_name);1346 @memcpy(canon.items, canon_name);
1347 try canon.append('.');1347 try canon.append('.');
13481348
1349 var tok_it = mem.tokenize(u8, search, " \t");1349 var tok_it = mem.tokenizeAny(u8, search, " \t");
1350 while (tok_it.next()) |tok| {1350 while (tok_it.next()) |tok| {
1351 canon.shrinkRetainingCapacity(canon_name.len + 1);1351 canon.shrinkRetainingCapacity(canon_name.len + 1);
1352 try canon.appendSlice(tok);1352 try canon.appendSlice(tok);
...@@ -1468,7 +1468,7 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void {...@@ -1468,7 +1468,7 @@ fn getResolvConf(allocator: mem.Allocator, rc: *ResolvConf) !void {
1468 var split = mem.split(u8, line, "#");1468 var split = mem.split(u8, line, "#");
1469 break :no_comment_line split.first();1469 break :no_comment_line split.first();
1470 };1470 };
1471 var line_it = mem.tokenize(u8, no_comment_line, " \t");1471 var line_it = mem.tokenizeAny(u8, no_comment_line, " \t");
14721472
1473 const token = line_it.next() orelse continue;1473 const token = line_it.next() orelse continue;
1474 if (mem.eql(u8, token, "options")) {1474 if (mem.eql(u8, token, "options")) {
lib/std/os.zig+1-1
...@@ -1878,7 +1878,7 @@ pub fn execvpeZ_expandArg0(...@@ -1878,7 +1878,7 @@ pub fn execvpeZ_expandArg0(
1878 // Use of MAX_PATH_BYTES here is valid as the path_buf will be passed1878 // Use of MAX_PATH_BYTES here is valid as the path_buf will be passed
1879 // directly to the operating system in execveZ.1879 // directly to the operating system in execveZ.
1880 var path_buf: [MAX_PATH_BYTES]u8 = undefined;1880 var path_buf: [MAX_PATH_BYTES]u8 = undefined;
1881 var it = mem.tokenize(u8, PATH, ":");1881 var it = mem.tokenizeScalar(u8, PATH, ':');
1882 var seen_eacces = false;1882 var seen_eacces = false;
1883 var err: ExecveError = error.FileNotFound;1883 var err: ExecveError = error.FileNotFound;
18841884
lib/std/process.zig+1-1
...@@ -1200,7 +1200,7 @@ fn totalSystemMemoryLinux() !usize {...@@ -1200,7 +1200,7 @@ fn totalSystemMemoryLinux() !usize {
1200 var buf: [50]u8 = undefined;1200 var buf: [50]u8 = undefined;
1201 const amt = try file.read(&buf);1201 const amt = try file.read(&buf);
1202 if (amt != 50) return error.Unexpected;1202 if (amt != 50) return error.Unexpected;
1203 var it = std.mem.tokenize(u8, buf[0..amt], " \n");1203 var it = std.mem.tokenizeAny(u8, buf[0..amt], " \n");
1204 const label = it.next().?;1204 const label = it.next().?;
1205 if (!std.mem.eql(u8, label, "MemTotal:")) return error.Unexpected;1205 if (!std.mem.eql(u8, label, "MemTotal:")) return error.Unexpected;
1206 const int_text = it.next() orelse return error.Unexpected;1206 const int_text = it.next() orelse return error.Unexpected;
lib/std/zig/system/NativePaths.zig+5-5
...@@ -31,7 +31,7 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths...@@ -31,7 +31,7 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
31 defer allocator.free(nix_cflags_compile);31 defer allocator.free(nix_cflags_compile);
3232
33 is_nix = true;33 is_nix = true;
34 var it = mem.tokenize(u8, nix_cflags_compile, " ");34 var it = mem.tokenizeScalar(u8, nix_cflags_compile, ' ');
35 while (true) {35 while (true) {
36 const word = it.next() orelse break;36 const word = it.next() orelse break;
37 if (mem.eql(u8, word, "-isystem")) {37 if (mem.eql(u8, word, "-isystem")) {
...@@ -62,7 +62,7 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths...@@ -62,7 +62,7 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
62 defer allocator.free(nix_ldflags);62 defer allocator.free(nix_ldflags);
6363
64 is_nix = true;64 is_nix = true;
65 var it = mem.tokenize(u8, nix_ldflags, " ");65 var it = mem.tokenizeScalar(u8, nix_ldflags, ' ');
66 while (true) {66 while (true) {
67 const word = it.next() orelse break;67 const word = it.next() orelse break;
68 if (mem.eql(u8, word, "-rpath")) {68 if (mem.eql(u8, word, "-rpath")) {
...@@ -147,21 +147,21 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths...@@ -147,21 +147,21 @@ pub fn detect(allocator: Allocator, native_info: NativeTargetInfo) !NativePaths
147 // We use os.getenv here since this part won't be executed on147 // We use os.getenv here since this part won't be executed on
148 // windows, to get rid of unnecessary error handling.148 // windows, to get rid of unnecessary error handling.
149 if (std.os.getenv("C_INCLUDE_PATH")) |c_include_path| {149 if (std.os.getenv("C_INCLUDE_PATH")) |c_include_path| {
150 var it = mem.tokenize(u8, c_include_path, ":");150 var it = mem.tokenizeScalar(u8, c_include_path, ':');
151 while (it.next()) |dir| {151 while (it.next()) |dir| {
152 try self.addIncludeDir(dir);152 try self.addIncludeDir(dir);
153 }153 }
154 }154 }
155155
156 if (std.os.getenv("CPLUS_INCLUDE_PATH")) |cplus_include_path| {156 if (std.os.getenv("CPLUS_INCLUDE_PATH")) |cplus_include_path| {
157 var it = mem.tokenize(u8, cplus_include_path, ":");157 var it = mem.tokenizeScalar(u8, cplus_include_path, ':');
158 while (it.next()) |dir| {158 while (it.next()) |dir| {
159 try self.addIncludeDir(dir);159 try self.addIncludeDir(dir);
160 }160 }
161 }161 }
162162
163 if (std.os.getenv("LIBRARY_PATH")) |library_path| {163 if (std.os.getenv("LIBRARY_PATH")) |library_path| {
164 var it = mem.tokenize(u8, library_path, ":");164 var it = mem.tokenizeScalar(u8, library_path, ':');
165 while (it.next()) |dir| {165 while (it.next()) |dir| {
166 try self.addLibDir(dir);166 try self.addLibDir(dir);
167 }167 }
lib/std/zig/system/NativeTargetInfo.zig+2-2
...@@ -354,7 +354,7 @@ fn detectAbiAndDynamicLinker(...@@ -354,7 +354,7 @@ fn detectAbiAndDynamicLinker(
354 const newline = mem.indexOfScalar(u8, buffer[0..len], '\n') orelse break :blk file;354 const newline = mem.indexOfScalar(u8, buffer[0..len], '\n') orelse break :blk file;
355 const line = buffer[0..newline];355 const line = buffer[0..newline];
356 if (!mem.startsWith(u8, line, "#!")) break :blk file;356 if (!mem.startsWith(u8, line, "#!")) break :blk file;
357 var it = mem.tokenize(u8, line[2..], " ");357 var it = mem.tokenizeScalar(u8, line[2..], ' ');
358 file_name = it.next() orelse return defaultAbiAndDynamicLinker(cpu, os, cross_target);358 file_name = it.next() orelse return defaultAbiAndDynamicLinker(cpu, os, cross_target);
359 file.close();359 file.close();
360 }360 }
...@@ -811,7 +811,7 @@ pub fn abiAndDynamicLinkerFromFile(...@@ -811,7 +811,7 @@ pub fn abiAndDynamicLinkerFromFile(
811 const strtab = strtab_buf[0..strtab_read_len];811 const strtab = strtab_buf[0..strtab_read_len];
812812
813 const rpath_list = mem.sliceTo(strtab, 0);813 const rpath_list = mem.sliceTo(strtab, 0);
814 var it = mem.tokenize(u8, rpath_list, ":");814 var it = mem.tokenizeScalar(u8, rpath_list, ':');
815 while (it.next()) |rpath| {815 while (it.next()) |rpath| {
816 if (glibcVerFromRPath(rpath)) |ver| {816 if (glibcVerFromRPath(rpath)) |ver| {
817 result.target.os.version_range.linux.glibc = ver;817 result.target.os.version_range.linux.glibc = ver;
src/arch/x86_64/CodeGen.zig+3-3
...@@ -8409,9 +8409,9 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -8409,9 +8409,9 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
8409 }8409 }
84108410
8411 const asm_source = mem.sliceAsBytes(self.air.extra[extra_i..])[0..extra.data.source_len];8411 const asm_source = mem.sliceAsBytes(self.air.extra[extra_i..])[0..extra.data.source_len];
8412 var line_it = mem.tokenize(u8, asm_source, "\n\r;");8412 var line_it = mem.tokenizeAny(u8, asm_source, "\n\r;");
8413 while (line_it.next()) |line| {8413 while (line_it.next()) |line| {
8414 var mnem_it = mem.tokenize(u8, line, " \t");8414 var mnem_it = mem.tokenizeAny(u8, line, " \t");
8415 const mnem_str = mnem_it.next() orelse continue;8415 const mnem_str = mnem_it.next() orelse continue;
8416 if (mem.startsWith(u8, mnem_str, "#")) continue;8416 if (mem.startsWith(u8, mnem_str, "#")) continue;
84178417
...@@ -8435,7 +8435,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {...@@ -8435,7 +8435,7 @@ fn airAsm(self: *Self, inst: Air.Inst.Index) !void {
8435 return self.fail("Invalid mnemonic: '{s}'", .{mnem_str});8435 return self.fail("Invalid mnemonic: '{s}'", .{mnem_str});
8436 } };8436 } };
84378437
8438 var op_it = mem.tokenize(u8, mnem_it.rest(), ",");8438 var op_it = mem.tokenizeScalar(u8, mnem_it.rest(), ',');
8439 var ops = [1]encoder.Instruction.Operand{.none} ** 4;8439 var ops = [1]encoder.Instruction.Operand{.none} ** 4;
8440 for (&ops) |*op| {8440 for (&ops) |*op| {
8441 const op_str = mem.trim(u8, op_it.next() orelse break, " \t");8441 const op_str = mem.trim(u8, op_it.next() orelse break, " \t");
src/glibc.zig+1-1
...@@ -109,7 +109,7 @@ pub fn loadMetaData(gpa: Allocator, contents: []const u8) LoadMetaDataError!*ABI...@@ -109,7 +109,7 @@ pub fn loadMetaData(gpa: Allocator, contents: []const u8) LoadMetaDataError!*ABI
109 const target_name = mem.sliceTo(contents[index..], 0);109 const target_name = mem.sliceTo(contents[index..], 0);
110 index += target_name.len + 1;110 index += target_name.len + 1;
111111
112 var component_it = mem.tokenize(u8, target_name, "-");112 var component_it = mem.tokenizeScalar(u8, target_name, '-');
113 const arch_name = component_it.next() orelse {113 const arch_name = component_it.next() orelse {
114 log.err("abilists: expected arch name", .{});114 log.err("abilists: expected arch name", .{});
115 return error.ZigInstallationCorrupt;115 return error.ZigInstallationCorrupt;
src/libc_installation.zig+4-4
...@@ -60,7 +60,7 @@ pub const LibCInstallation = struct {...@@ -60,7 +60,7 @@ pub const LibCInstallation = struct {
60 const contents = try std.fs.cwd().readFileAlloc(allocator, libc_file, std.math.maxInt(usize));60 const contents = try std.fs.cwd().readFileAlloc(allocator, libc_file, std.math.maxInt(usize));
61 defer allocator.free(contents);61 defer allocator.free(contents);
6262
63 var it = std.mem.tokenize(u8, contents, "\n");63 var it = std.mem.tokenizeScalar(u8, contents, '\n');
64 while (it.next()) |line| {64 while (it.next()) |line| {
65 if (line.len == 0 or line[0] == '#') continue;65 if (line.len == 0 or line[0] == '#') continue;
66 var line_it = std.mem.split(u8, line, "=");66 var line_it = std.mem.split(u8, line, "=");
...@@ -293,7 +293,7 @@ pub const LibCInstallation = struct {...@@ -293,7 +293,7 @@ pub const LibCInstallation = struct {
293 },293 },
294 }294 }
295295
296 var it = std.mem.tokenize(u8, exec_res.stderr, "\n\r");296 var it = std.mem.tokenizeAny(u8, exec_res.stderr, "\n\r");
297 var search_paths = std.ArrayList([]const u8).init(allocator);297 var search_paths = std.ArrayList([]const u8).init(allocator);
298 defer search_paths.deinit();298 defer search_paths.deinit();
299 while (it.next()) |line| {299 while (it.next()) |line| {
...@@ -613,7 +613,7 @@ fn ccPrintFileName(args: CCPrintFileNameOptions) ![:0]u8 {...@@ -613,7 +613,7 @@ fn ccPrintFileName(args: CCPrintFileNameOptions) ![:0]u8 {
613 },613 },
614 }614 }
615615
616 var it = std.mem.tokenize(u8, exec_res.stdout, "\n\r");616 var it = std.mem.tokenizeAny(u8, exec_res.stdout, "\n\r");
617 const line = it.next() orelse return error.LibCRuntimeNotFound;617 const line = it.next() orelse return error.LibCRuntimeNotFound;
618 // When this command fails, it returns exit code 0 and duplicates the input file name.618 // When this command fails, it returns exit code 0 and duplicates the input file name.
619 // So we detect failure by checking if the output matches exactly the input.619 // So we detect failure by checking if the output matches exactly the input.
...@@ -692,7 +692,7 @@ fn appendCcExe(args: *std.ArrayList([]const u8), skip_cc_env_var: bool) !void {...@@ -692,7 +692,7 @@ fn appendCcExe(args: *std.ArrayList([]const u8), skip_cc_env_var: bool) !void {
692 return;692 return;
693 };693 };
694 // Respect space-separated flags to the C compiler.694 // Respect space-separated flags to the C compiler.
695 var it = std.mem.tokenize(u8, cc_env_var, " ");695 var it = std.mem.tokenizeScalar(u8, cc_env_var, ' ');
696 while (it.next()) |arg| {696 while (it.next()) |arg| {
697 try args.append(arg);697 try args.append(arg);
698 }698 }
src/link/Plan9.zig+1-1
...@@ -264,7 +264,7 @@ fn putFn(self: *Plan9, decl_index: Module.Decl.Index, out: FnDeclOutput) !void {...@@ -264,7 +264,7 @@ fn putFn(self: *Plan9, decl_index: Module.Decl.Index, out: FnDeclOutput) !void {
264264
265fn addPathComponents(self: *Plan9, path: []const u8, a: *std.ArrayList(u8)) !void {265fn addPathComponents(self: *Plan9, path: []const u8, a: *std.ArrayList(u8)) !void {
266 const sep = std.fs.path.sep;266 const sep = std.fs.path.sep;
267 var it = std.mem.tokenize(u8, path, &.{sep});267 var it = std.mem.tokenizeScalar(u8, path, sep);
268 while (it.next()) |component| {268 while (it.next()) |component| {
269 if (self.file_segments.get(component)) |num| {269 if (self.file_segments.get(component)) |num| {
270 try a.writer().writeIntBig(u16, num);270 try a.writer().writeIntBig(u16, num);
src/print_zir.zig+1-1
...@@ -2581,7 +2581,7 @@ const Writer = struct {...@@ -2581,7 +2581,7 @@ const Writer = struct {
2581 fn writeDocComment(self: *Writer, stream: anytype, doc_comment_index: u32) !void {2581 fn writeDocComment(self: *Writer, stream: anytype, doc_comment_index: u32) !void {
2582 if (doc_comment_index != 0) {2582 if (doc_comment_index != 0) {
2583 const doc_comment = self.code.nullTerminatedString(doc_comment_index);2583 const doc_comment = self.code.nullTerminatedString(doc_comment_index);
2584 var it = std.mem.tokenize(u8, doc_comment, "\n");2584 var it = std.mem.tokenizeScalar(u8, doc_comment, '\n');
2585 while (it.next()) |doc_line| {2585 while (it.next()) |doc_line| {
2586 try stream.writeByteNTimes(' ', self.indent);2586 try stream.writeByteNTimes(' ', self.indent);
2587 try stream.print("///{s}\n", .{doc_line});2587 try stream.print("///{s}\n", .{doc_line});
test/behavior/bugs/6456.zig+1-1
...@@ -18,7 +18,7 @@ test "issue 6456" {...@@ -18,7 +18,7 @@ test "issue 6456" {
18 comptime {18 comptime {
19 var fields: []const StructField = &[0]StructField{};19 var fields: []const StructField = &[0]StructField{};
2020
21 var it = std.mem.tokenize(u8, text, "\n");21 var it = std.mem.tokenizeScalar(u8, text, '\n');
22 while (it.next()) |name| {22 while (it.next()) |name| {
23 fields = fields ++ &[_]StructField{StructField{23 fields = fields ++ &[_]StructField{StructField{
24 .alignment = 0,24 .alignment = 0,
test/src/Cases.zig+2-2
...@@ -846,7 +846,7 @@ const TestManifest = struct {...@@ -846,7 +846,7 @@ const TestManifest = struct {
846 const actual_start = start orelse return error.MissingTestManifest;846 const actual_start = start orelse return error.MissingTestManifest;
847 const manifest_bytes = bytes[actual_start..end];847 const manifest_bytes = bytes[actual_start..end];
848848
849 var it = std.mem.tokenize(u8, manifest_bytes, "\r\n");849 var it = std.mem.tokenizeAny(u8, manifest_bytes, "\r\n");
850850
851 // First line is the test type851 // First line is the test type
852 const tt: Type = blk: {852 const tt: Type = blk: {
...@@ -923,7 +923,7 @@ const TestManifest = struct {...@@ -923,7 +923,7 @@ const TestManifest = struct {
923923
924 fn trailing(self: TestManifest) TrailingIterator {924 fn trailing(self: TestManifest) TrailingIterator {
925 return .{925 return .{
926 .inner = std.mem.tokenize(u8, self.trailing_bytes, "\r\n"),926 .inner = std.mem.tokenizeAny(u8, self.trailing_bytes, "\r\n"),
927 };927 };
928 }928 }
929929
tools/generate_linux_syscalls.zig+18-18
...@@ -51,11 +51,11 @@ pub fn main() !void {...@@ -51,11 +51,11 @@ pub fn main() !void {
51 try writer.writeAll("pub const X86 = enum(usize) {\n");51 try writer.writeAll("pub const X86 = enum(usize) {\n");
5252
53 const table = try linux_dir.readFile("arch/x86/entry/syscalls/syscall_32.tbl", buf);53 const table = try linux_dir.readFile("arch/x86/entry/syscalls/syscall_32.tbl", buf);
54 var lines = mem.tokenize(u8, table, "\n");54 var lines = mem.tokenizeScalar(u8, table, '\n');
55 while (lines.next()) |line| {55 while (lines.next()) |line| {
56 if (line[0] == '#') continue;56 if (line[0] == '#') continue;
5757
58 var fields = mem.tokenize(u8, line, " \t");58 var fields = mem.tokenizeAny(u8, line, " \t");
59 const number = fields.next() orelse return error.Incomplete;59 const number = fields.next() orelse return error.Incomplete;
60 // abi is always i38660 // abi is always i386
61 _ = fields.next() orelse return error.Incomplete;61 _ = fields.next() orelse return error.Incomplete;
...@@ -70,11 +70,11 @@ pub fn main() !void {...@@ -70,11 +70,11 @@ pub fn main() !void {
70 try writer.writeAll("pub const X64 = enum(usize) {\n");70 try writer.writeAll("pub const X64 = enum(usize) {\n");
7171
72 const table = try linux_dir.readFile("arch/x86/entry/syscalls/syscall_64.tbl", buf);72 const table = try linux_dir.readFile("arch/x86/entry/syscalls/syscall_64.tbl", buf);
73 var lines = mem.tokenize(u8, table, "\n");73 var lines = mem.tokenizeScalar(u8, table, '\n');
74 while (lines.next()) |line| {74 while (lines.next()) |line| {
75 if (line[0] == '#') continue;75 if (line[0] == '#') continue;
7676
77 var fields = mem.tokenize(u8, line, " \t");77 var fields = mem.tokenizeAny(u8, line, " \t");
78 const number = fields.next() orelse return error.Incomplete;78 const number = fields.next() orelse return error.Incomplete;
79 const abi = fields.next() orelse return error.Incomplete;79 const abi = fields.next() orelse return error.Incomplete;
80 // The x32 abi syscalls are always at the end.80 // The x32 abi syscalls are always at the end.
...@@ -96,11 +96,11 @@ pub fn main() !void {...@@ -96,11 +96,11 @@ pub fn main() !void {
96 );96 );
9797
98 const table = try linux_dir.readFile("arch/arm/tools/syscall.tbl", buf);98 const table = try linux_dir.readFile("arch/arm/tools/syscall.tbl", buf);
99 var lines = mem.tokenize(u8, table, "\n");99 var lines = mem.tokenizeScalar(u8, table, '\n');
100 while (lines.next()) |line| {100 while (lines.next()) |line| {
101 if (line[0] == '#') continue;101 if (line[0] == '#') continue;
102102
103 var fields = mem.tokenize(u8, line, " \t");103 var fields = mem.tokenizeAny(u8, line, " \t");
104 const number = fields.next() orelse return error.Incomplete;104 const number = fields.next() orelse return error.Incomplete;
105 const abi = fields.next() orelse return error.Incomplete;105 const abi = fields.next() orelse return error.Incomplete;
106 if (mem.eql(u8, abi, "oabi")) continue;106 if (mem.eql(u8, abi, "oabi")) continue;
...@@ -127,11 +127,11 @@ pub fn main() !void {...@@ -127,11 +127,11 @@ pub fn main() !void {
127 {127 {
128 try writer.writeAll("pub const Sparc64 = enum(usize) {\n");128 try writer.writeAll("pub const Sparc64 = enum(usize) {\n");
129 const table = try linux_dir.readFile("arch/sparc/kernel/syscalls/syscall.tbl", buf);129 const table = try linux_dir.readFile("arch/sparc/kernel/syscalls/syscall.tbl", buf);
130 var lines = mem.tokenize(u8, table, "\n");130 var lines = mem.tokenizeScalar(u8, table, '\n');
131 while (lines.next()) |line| {131 while (lines.next()) |line| {
132 if (line[0] == '#') continue;132 if (line[0] == '#') continue;
133133
134 var fields = mem.tokenize(u8, line, " \t");134 var fields = mem.tokenizeAny(u8, line, " \t");
135 const number = fields.next() orelse return error.Incomplete;135 const number = fields.next() orelse return error.Incomplete;
136 const abi = fields.next() orelse return error.Incomplete;136 const abi = fields.next() orelse return error.Incomplete;
137 if (mem.eql(u8, abi, "32")) continue;137 if (mem.eql(u8, abi, "32")) continue;
...@@ -151,11 +151,11 @@ pub fn main() !void {...@@ -151,11 +151,11 @@ pub fn main() !void {
151 );151 );
152152
153 const table = try linux_dir.readFile("arch/mips/kernel/syscalls/syscall_o32.tbl", buf);153 const table = try linux_dir.readFile("arch/mips/kernel/syscalls/syscall_o32.tbl", buf);
154 var lines = mem.tokenize(u8, table, "\n");154 var lines = mem.tokenizeScalar(u8, table, '\n');
155 while (lines.next()) |line| {155 while (lines.next()) |line| {
156 if (line[0] == '#') continue;156 if (line[0] == '#') continue;
157157
158 var fields = mem.tokenize(u8, line, " \t");158 var fields = mem.tokenizeAny(u8, line, " \t");
159 const number = fields.next() orelse return error.Incomplete;159 const number = fields.next() orelse return error.Incomplete;
160 // abi is always o32160 // abi is always o32
161 _ = fields.next() orelse return error.Incomplete;161 _ = fields.next() orelse return error.Incomplete;
...@@ -176,11 +176,11 @@ pub fn main() !void {...@@ -176,11 +176,11 @@ pub fn main() !void {
176 );176 );
177177
178 const table = try linux_dir.readFile("arch/mips/kernel/syscalls/syscall_n64.tbl", buf);178 const table = try linux_dir.readFile("arch/mips/kernel/syscalls/syscall_n64.tbl", buf);
179 var lines = mem.tokenize(u8, table, "\n");179 var lines = mem.tokenizeScalar(u8, table, '\n');
180 while (lines.next()) |line| {180 while (lines.next()) |line| {
181 if (line[0] == '#') continue;181 if (line[0] == '#') continue;
182182
183 var fields = mem.tokenize(u8, line, " \t");183 var fields = mem.tokenizeAny(u8, line, " \t");
184 const number = fields.next() orelse return error.Incomplete;184 const number = fields.next() orelse return error.Incomplete;
185 // abi is always n64185 // abi is always n64
186 _ = fields.next() orelse return error.Incomplete;186 _ = fields.next() orelse return error.Incomplete;
...@@ -197,11 +197,11 @@ pub fn main() !void {...@@ -197,11 +197,11 @@ pub fn main() !void {
197197
198 const table = try linux_dir.readFile("arch/powerpc/kernel/syscalls/syscall.tbl", buf);198 const table = try linux_dir.readFile("arch/powerpc/kernel/syscalls/syscall.tbl", buf);
199 var list_64 = std.ArrayList(u8).init(allocator);199 var list_64 = std.ArrayList(u8).init(allocator);
200 var lines = mem.tokenize(u8, table, "\n");200 var lines = mem.tokenizeScalar(u8, table, '\n');
201 while (lines.next()) |line| {201 while (lines.next()) |line| {
202 if (line[0] == '#') continue;202 if (line[0] == '#') continue;
203203
204 var fields = mem.tokenize(u8, line, " \t");204 var fields = mem.tokenizeAny(u8, line, " \t");
205 const number = fields.next() orelse return error.Incomplete;205 const number = fields.next() orelse return error.Incomplete;
206 const abi = fields.next() orelse return error.Incomplete;206 const abi = fields.next() orelse return error.Incomplete;
207 const name = fields.next() orelse return error.Incomplete;207 const name = fields.next() orelse return error.Incomplete;
...@@ -277,9 +277,9 @@ pub fn main() !void {...@@ -277,9 +277,9 @@ pub fn main() !void {
277 },277 },
278 };278 };
279279
280 var lines = mem.tokenize(u8, defines, "\n");280 var lines = mem.tokenizeScalar(u8, defines, '\n');
281 loop: while (lines.next()) |line| {281 loop: while (lines.next()) |line| {
282 var fields = mem.tokenize(u8, line, " \t");282 var fields = mem.tokenizeAny(u8, line, " \t");
283 const cmd = fields.next() orelse return error.Incomplete;283 const cmd = fields.next() orelse return error.Incomplete;
284 if (!mem.eql(u8, cmd, "#define")) continue;284 if (!mem.eql(u8, cmd, "#define")) continue;
285 const define = fields.next() orelse return error.Incomplete;285 const define = fields.next() orelse return error.Incomplete;
...@@ -339,9 +339,9 @@ pub fn main() !void {...@@ -339,9 +339,9 @@ pub fn main() !void {
339 },339 },
340 };340 };
341341
342 var lines = mem.tokenize(u8, defines, "\n");342 var lines = mem.tokenizeScalar(u8, defines, '\n');
343 loop: while (lines.next()) |line| {343 loop: while (lines.next()) |line| {
344 var fields = mem.tokenize(u8, line, " \t");344 var fields = mem.tokenizeAny(u8, line, " \t");
345 const cmd = fields.next() orelse return error.Incomplete;345 const cmd = fields.next() orelse return error.Incomplete;
346 if (!mem.eql(u8, cmd, "#define")) continue;346 if (!mem.eql(u8, cmd, "#define")) continue;
347 const define = fields.next() orelse return error.Incomplete;347 const define = fields.next() orelse return error.Incomplete;