From fed963312199e332d556c59f4dbb56acfd2262ed Mon Sep 17 00:00:00 2001 From: Rene Schallner Date: Thu, 27 Jun 2024 19:33:04 +0200 Subject: [PATCH] make zap master build with zig master --- src/http_auth.zig | 2 +- src/request.zig | 8 ++++---- src/zap.zig | 2 +- tools/announceybot.zig | 6 +++--- tools/pkghash.zig | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/http_auth.zig b/src/http_auth.zig index 6cba1f68..ca67d887 100644 --- a/src/http_auth.zig +++ b/src/http_auth.zig @@ -132,7 +132,7 @@ pub fn Basic(comptime Lookup: type, comptime kind: BasicAuthStrategy) type { }; // we have decoded // we can split - var it = std.mem.split(u8, decoded, ":"); + var it = std.mem.splitScalar(u8, decoded, ':'); const user = it.next(); const pass = it.next(); if (user == null or pass == null) { diff --git a/src/request.zig b/src/request.zig index a2095310..1b7c66b5 100644 --- a/src/request.zig +++ b/src/request.zig @@ -612,13 +612,13 @@ pub fn parseAcceptHeaders(self: *const Self, allocator: std.mem.Allocator) !Acce var list = try AcceptHeaderList.initCapacity(allocator, comma_count + 1); errdefer list.deinit(); - var tok_iter = std.mem.tokenize(u8, accept_str, ", "); + var tok_iter = std.mem.splitSequence(u8, accept_str, ", "); while (tok_iter.next()) |tok| { - var split_iter = std.mem.split(u8, tok, ";"); + var split_iter = std.mem.splitScalar(u8, tok, ';'); const mimetype_str = split_iter.next().?; const q_factor = q_factor: { const q_factor_str = split_iter.next() orelse break :q_factor 1; - var eq_iter = std.mem.split(u8, q_factor_str, "="); + var eq_iter = std.mem.splitScalar(u8, q_factor_str, '='); const q = eq_iter.next().?; if (q[0] != 'q') break :q_factor 1; const value = eq_iter.next() orelse break :q_factor 1; @@ -626,7 +626,7 @@ pub fn parseAcceptHeaders(self: *const Self, allocator: std.mem.Allocator) !Acce break :q_factor parsed; }; - var type_split_iter = std.mem.split(u8, mimetype_str, "/"); + var type_split_iter = std.mem.splitScalar(u8, mimetype_str, '/'); const mimetype_type_str = type_split_iter.next() orelse continue; const mimetype_subtype_str = type_split_iter.next() orelse continue; diff --git a/src/zap.zig b/src/zap.zig index a766e709..3cbe2160 100644 --- a/src/zap.zig +++ b/src/zap.zig @@ -164,7 +164,7 @@ pub const ContentType = enum { XHTML, // TODO: more content types - pub const string_map = std.ComptimeStringMap(ContentType, .{ + pub const string_map = std.StaticStringMap(ContentType).initComptime(.{ .{ "text/plain", .TEXT }, .{ "text/html", .HTML }, .{ "application/xml", .XML }, diff --git a/tools/announceybot.zig b/tools/announceybot.zig index 3a88deb7..0a2c5a38 100644 --- a/tools/announceybot.zig +++ b/tools/announceybot.zig @@ -89,7 +89,7 @@ fn get_tag_annotation(allocator: std.mem.Allocator, tagname: []const u8) ![]cons tagname, }; - const result = try std.ChildProcess.run(.{ + const result = try std.process.Child.run(.{ .allocator = allocator, .argv = &args, }); @@ -159,7 +159,7 @@ fn sendToDiscordPart(allocator: std.mem.Allocator, url: []const u8, message_json // request var req = try http_client.open(.POST, uri, .{ - .server_header_buffer = &server_header_buffer, + .server_header_buffer = &server_header_buffer, .extra_headers = &.{ .{ .name = "accept", .value = "*/*" }, .{ .name = "Content-Type", .value = "application/json" }, @@ -382,7 +382,7 @@ fn command_update_readme(allocator: std.mem.Allocator, tag: []const u8) !void { // iterate over lines var in_replace_block: bool = false; - var line_it = std.mem.split(u8, readme, "\n"); + var line_it = std.mem.splitScalar(u8, readme, '\n'); while (line_it.next()) |line| { if (in_replace_block) { if (std.mem.startsWith(u8, line, REPLACE_END_MARKER)) { diff --git a/tools/pkghash.zig b/tools/pkghash.zig index 805206aa..29e51532 100644 --- a/tools/pkghash.zig +++ b/tools/pkghash.zig @@ -71,7 +71,7 @@ pub const usage_pkg = ; pub fn gitLatestTag(gpa: Allocator, pkg_dir: []const u8) ![]const u8 { - const result = try std.ChildProcess.run(.{ + const result = try std.process.Child.run(.{ .allocator = gpa, .argv = &.{ "git", @@ -97,7 +97,7 @@ pub fn gitLatestTag(gpa: Allocator, pkg_dir: []const u8) ![]const u8 { } pub fn gitFileList(gpa: Allocator, pkg_dir: []const u8) ![]const u8 { - const result = try std.ChildProcess.run(.{ + const result = try std.process.Child.run(.{ .allocator = gpa, .argv = &.{ "git", @@ -449,7 +449,7 @@ pub fn computePackageHashForFileList( var wait_group: WaitGroup = .{}; defer wait_group.wait(); - var it = std.mem.split(u8, file_list, "\n"); + var it = std.mem.splitScalar(u8, file_list, '\n'); while (it.next()) |entry| { if (entry.len > 0) {