Skip to content

Commit

Permalink
Merge pull request #142 from kubkon/update-zig
Browse files Browse the repository at this point in the history
update to latest zig changes
  • Loading branch information
kubkon committed Jun 16, 2024
2 parents 01da879 + 1db23ca commit 135c594
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/Elf.zig
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ fn resolveFile(
}

const path = path: {
var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
var buffer: [fs.max_path_bytes]u8 = undefined;
const path = std.fs.realpath(obj.path, &buffer) catch |err| switch (err) {
error.FileNotFound => {
for (search_dirs) |search_dir| {
Expand Down Expand Up @@ -508,7 +508,7 @@ fn sortInitFini(self: *Elf) !void {
}
const default: i32 = if (is_ctor_dtor) -1 else std.math.maxInt(i32);
const name = atom.getName(self);
var it = mem.splitBackwards(u8, name, ".");
var it = mem.splitBackwardsScalar(u8, name, '.');
const priority = std.fmt.parseUnsigned(u16, it.first(), 10) catch default;
break :blk priority;
};
Expand Down
2 changes: 1 addition & 1 deletion src/Elf/Options.zig
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ pub fn parse(arena: Allocator, args: []const []const u8, ctx: anytype) !Options
} else if (p.flagZ("muldefs")) {
opts.allow_multiple_definition = true;
} else if (p.argAny("section-start")) |pair| {
var pair_it = std.mem.split(u8, pair, "=");
var pair_it = std.mem.splitScalar(u8, pair, '=');
const name = pair_it.next() orelse ctx.fatal("expected section=address mapping", .{});
const value = pair_it.next() orelse ctx.fatal("expected section=address mapping", .{});
try opts.parseSectionStart(arena, name, value, ctx);
Expand Down
6 changes: 3 additions & 3 deletions src/MachO.zig
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ pub fn flush(self: *MachO) !void {
const full_path = blk: {
switch (obj.tag) {
.obj => {
var buffer: [fs.MAX_PATH_BYTES]u8 = undefined;
var buffer: [fs.max_path_bytes]u8 = undefined;
const full_path = std.fs.realpath(obj.path, &buffer) catch |err| switch (err) {
error.FileNotFound => {
self.base.fatal("file not found {}", .{obj});
Expand Down Expand Up @@ -944,7 +944,7 @@ fn parseDependentDylibs(
for (self.getFile(dylib.umbrella).?.dylib.rpaths.keys()) |rpath| {
const prefix = eatPrefix(rpath, "@loader_path/") orelse rpath;
const rel_path = try std.fs.path.join(arena, &.{ prefix, path });
var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var buffer: [std.fs.max_path_bytes]u8 = undefined;
const full_path = std.fs.realpath(rel_path, &buffer) catch continue;
break :full_path try arena.dupe(u8, full_path);
}
Expand All @@ -958,7 +958,7 @@ fn parseDependentDylibs(
});
}

var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var buffer: [std.fs.max_path_bytes]u8 = undefined;
if (std.fs.realpath(id.name, &buffer)) |full_path| {
break :full_path try arena.dupe(u8, full_path);
} else |_| {
Expand Down
2 changes: 1 addition & 1 deletion src/MachO/Dylib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ pub const Id = struct {
var out: u32 = 0;
var values: [3][]const u8 = undefined;

var split = mem.split(u8, string, ".");
var split = mem.splitScalar(u8, string, '.');
var count: u4 = 0;
while (split.next()) |value| {
if (count > 2) {
Expand Down
2 changes: 1 addition & 1 deletion src/Wasm.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1895,7 +1895,7 @@ fn validateFeatures(wasm: *Wasm) !void {
// When the user has given an explicit list of features to enable,
// we extract them and insert each into the 'allowed' list.
if (!infer) {
var it = std.mem.split(u8, wasm.options.features, ",");
var it = std.mem.splitScalar(u8, wasm.options.features, ',');
while (it.next()) |feature_name| {
const feature = types.known_features.get(feature_name) orelse {
log.err("Unknown feature name '{s}' passed as option", .{feature_name});
Expand Down
2 changes: 1 addition & 1 deletion src/Wasm/Archive.zig
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ pub fn parseObject(archive: Archive, allocator: Allocator, file_offset: u32) !Ob

const object_name = try archive.parseName(header);
const name = name: {
var buffer: [std.fs.MAX_PATH_BYTES]u8 = undefined;
var buffer: [std.fs.max_path_bytes]u8 = undefined;
const path = try std.posix.realpath(archive.name, &buffer);
break :name try std.fmt.allocPrint(allocator, "{s}({s})", .{ path, object_name });
};
Expand Down

0 comments on commit 135c594

Please sign in to comment.