Skip to content

Commit

Permalink
make zap master build with zig master
Browse files Browse the repository at this point in the history
  • Loading branch information
renerocksai committed Jun 27, 2024
1 parent 3f9c7d0 commit fed9633
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/http_auth.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
8 changes: 4 additions & 4 deletions src/request.zig
Original file line number Diff line number Diff line change
Expand Up @@ -612,21 +612,21 @@ 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;
const parsed = std.fmt.parseFloat(f64, value) catch break :q_factor 1;
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;
Expand Down
2 changes: 1 addition & 1 deletion src/zap.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand Down
6 changes: 3 additions & 3 deletions tools/announceybot.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down Expand Up @@ -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" },
Expand Down Expand Up @@ -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)) {
Expand Down
6 changes: 3 additions & 3 deletions tools/pkghash.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit fed9633

Please sign in to comment.