| author | |
| committer | |
| log | 6aa244fffd454b871bebf38194c5a55ed52a8abb |
| tree | 722603e15d0b3cf460332fa3330a69a9575cf7e0 |
| parent | ae17b466f8c7971edd28125a68a4f9ffdc291dd9 |
4 files changed, 15 insertions(+), 15 deletions(-)
src/common.zig+5-5| ... | ... | @@ -127,10 +127,10 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! |
| 127 | 127 | }, |
| 128 | 128 | .git => { |
| 129 | 129 | if (d.version.len > 0) { |
| 130 | const vers = u.parse_split(zigmod.Dep.Type.Version.Git, "-").do(d.version) catch |e| switch (e) { | |
| 130 | const vers = u.parse_split(zigmod.Dep.Type.Version.Git, '-').do(d.version) catch |e| switch (e) { | |
| 131 | 131 | error.IterEmpty => unreachable, |
| 132 | 132 | error.NoMemberFound => { |
| 133 | const vtype = d.version[0..std.mem.indexOf(u8, d.version, "-").?]; | |
| 133 | const vtype = d.version[0..std.mem.indexOfScalar(u8, d.version, '-').?]; | |
| 134 | 134 | u.fail("fetch: git: version type '{s}' is invalid.", .{vtype}); |
| 135 | 135 | }, |
| 136 | 136 | }; |
| ... | ... | @@ -179,7 +179,7 @@ pub fn get_modpath(cachepath: string, d: zigmod.Dep, options: *CollectOptions) ! |
| 179 | 179 | if (try extras.doesFolderExist(null, pv)) { |
| 180 | 180 | return pv; |
| 181 | 181 | } |
| 182 | const file_name = u.last(try u.split(options.alloc, d.path, "/")).?; | |
| 182 | const file_name = u.last(try u.split(options.alloc, d.path, '/')).?; | |
| 183 | 183 | if (d.version.len > 0) { |
| 184 | 184 | if (try extras.doesFolderExist(null, pv)) { |
| 185 | 185 | return pv; |
| ... | ... | @@ -338,7 +338,7 @@ pub fn parse_lockfile(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const [4]str |
| 338 | 338 | } |
| 339 | 339 | switch (v) { |
| 340 | 340 | 1 => { |
| 341 | var iter = std.mem.split(u8, line, " "); | |
| 341 | var iter = std.mem.splitScalar(u8, line, ' '); | |
| 342 | 342 | try list.append([4]string{ |
| 343 | 343 | iter.next().?, |
| 344 | 344 | iter.next().?, |
| ... | ... | @@ -347,7 +347,7 @@ pub fn parse_lockfile(alloc: std.mem.Allocator, dir: std.fs.Dir) ![]const [4]str |
| 347 | 347 | }); |
| 348 | 348 | }, |
| 349 | 349 | 2 => { |
| 350 | var iter = std.mem.split(u8, line, " "); | |
| 350 | var iter = std.mem.splitScalar(u8, line, ' '); | |
| 351 | 351 | const asdep = zigmod.Dep{ |
| 352 | 352 | .type = std.meta.stringToEnum(zigmod.Dep.Type, iter.next().?).?, |
| 353 | 353 | .path = iter.next().?, |
src/util/dep.zig+1-1| ... | ... | @@ -71,7 +71,7 @@ pub const Dep = struct { |
| 71 | 71 | } |
| 72 | 72 | return switch (self.type) { |
| 73 | 73 | .git => blk: { |
| 74 | const vers = try u.parse_split(zigmod.Dep.Type.Version.Git, "-").do(self.version); | |
| 74 | const vers = try u.parse_split(zigmod.Dep.Type.Version.Git, '-').do(self.version); | |
| 75 | 75 | if (vers.id.frozen()) break :blk self.version; |
| 76 | 76 | break :blk try self.type.exact_version(alloc, dpath); |
| 77 | 77 | }, |
src/util/funcs.zig+6-6| ... | ... | @@ -36,11 +36,11 @@ pub fn try_index(comptime T: type, array: []T, n: usize, def: T) T { |
| 36 | 36 | return array[n]; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | pub fn split(alloc: std.mem.Allocator, in: string, delim: string) ![]string { | |
| 39 | pub fn split(alloc: std.mem.Allocator, in: string, delim: u8) ![]string { | |
| 40 | 40 | var list = std.ArrayList(string).init(alloc); |
| 41 | 41 | errdefer list.deinit(); |
| 42 | 42 | |
| 43 | var iter = std.mem.split(u8, in, delim); | |
| 43 | var iter = std.mem.splitScalar(u8, in, delim); | |
| 44 | 44 | while (iter.next()) |str| { |
| 45 | 45 | try list.append(str); |
| 46 | 46 | } |
| ... | ... | @@ -99,7 +99,7 @@ pub fn random_string(comptime len: usize) [len]u8 { |
| 99 | 99 | return buf; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | pub fn parse_split(comptime T: type, comptime delim: string) type { | |
| 102 | pub fn parse_split(comptime T: type, comptime delim: u8) type { | |
| 103 | 103 | return struct { |
| 104 | 104 | const Self = @This(); |
| 105 | 105 | |
| ... | ... | @@ -107,7 +107,7 @@ pub fn parse_split(comptime T: type, comptime delim: string) type { |
| 107 | 107 | string: string, |
| 108 | 108 | |
| 109 | 109 | pub fn do(input: string) !Self { |
| 110 | var iter = std.mem.split(u8, input, delim); | |
| 110 | var iter = std.mem.splitScalar(u8, input, delim); | |
| 111 | 111 | const start = iter.next() orelse return error.IterEmpty; |
| 112 | 112 | const id = std.meta.stringToEnum(T, start) orelse return error.NoMemberFound; |
| 113 | 113 | return Self{ |
| ... | ... | @@ -125,7 +125,7 @@ pub const HashFn = enum { |
| 125 | 125 | }; |
| 126 | 126 | |
| 127 | 127 | pub fn validate_hash(alloc: std.mem.Allocator, input: string, file_path: string) !bool { |
| 128 | const hash = parse_split(HashFn, "-").do(input) catch return false; | |
| 128 | const hash = parse_split(HashFn, '-').do(input) catch return false; | |
| 129 | 129 | const file = try std.fs.cwd().openFile(file_path, .{}); |
| 130 | 130 | defer file.close(); |
| 131 | 131 | const data = try file.reader().readAllAlloc(alloc, gb); |
| ... | ... | @@ -169,7 +169,7 @@ pub fn detect_pkgname(alloc: std.mem.Allocator, override: string, dir: string) ! |
| 169 | 169 | return error.NoBuildZig; |
| 170 | 170 | } |
| 171 | 171 | const dpath = try std.fs.realpathAlloc(alloc, try std.fs.path.join(alloc, &.{ dir, "build.zig" })); |
| 172 | const splitP = try split(alloc, dpath, std.fs.path.sep_str); | |
| 172 | const splitP = try split(alloc, dpath, std.fs.path.sep); | |
| 173 | 173 | var name = splitP[splitP.len - 2]; |
| 174 | 174 | name = extras.trimPrefix(name, "zig-"); |
| 175 | 175 | assert(name.len > 0, "package name must not be an empty string", .{}); |
src/util/modfile.zig+3-3| ... | ... | @@ -93,7 +93,7 @@ pub const ModFile = struct { |
| 93 | 93 | var main = item.mapping.get_string("main") orelse ""; |
| 94 | 94 | |
| 95 | 95 | if (item.mapping.get("src")) |val| { |
| 96 | var src_iter = std.mem.tokenize(u8, val.string, " "); | |
| 96 | var src_iter = std.mem.tokenizeScalar(u8, val.string, ' '); | |
| 97 | 97 | dtype = src_iter.next().?; |
| 98 | 98 | path = src_iter.next().?; |
| 99 | 99 | if (src_iter.next()) |dver| { |
| ... | ... | @@ -130,8 +130,8 @@ pub const ModFile = struct { |
| 130 | 130 | .c_include_dirs = try item.mapping.get_string_array(alloc, "c_include_dirs"), |
| 131 | 131 | .c_source_flags = try item.mapping.get_string_array(alloc, "c_source_flags"), |
| 132 | 132 | .c_source_files = try item.mapping.get_string_array(alloc, "c_source_files"), |
| 133 | .only_os = try u.list_remove(alloc, try u.split(alloc, item.mapping.get_string("only_os") orelse "", ","), ""), | |
| 134 | .except_os = try u.list_remove(alloc, try u.split(alloc, item.mapping.get_string("except_os") orelse "", ","), ""), | |
| 133 | .only_os = try u.list_remove(alloc, try u.split(alloc, item.mapping.get_string("only_os") orelse "", ','), ""), | |
| 134 | .except_os = try u.list_remove(alloc, try u.split(alloc, item.mapping.get_string("except_os") orelse "", ','), ""), | |
| 135 | 135 | .yaml = item.mapping, |
| 136 | 136 | .deps = try dep_list_by_name(alloc, item.mapping, &.{"dependencies"}, for_build), |
| 137 | 137 | .keep = std.mem.eql(u8, "true", item.mapping.get_string("keep") orelse ""), |