Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix @fieldParentPtr #91

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.{
.name = "libxev",
.minimum_zig_version = "0.12.0-dev.3191+9cf28d1e9",
.minimum_zig_version = "0.12.0-dev.3508+a6ed3e6d2",
.paths = .{""},
.version = "0.0.0",
}
2 changes: 1 addition & 1 deletion src/ThreadPool.zig
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ const Thread = struct {
thread_pool.notify(is_waking);
is_waking = false;

const task = @fieldParentPtr(Task, "node", result.node);
const task: *Task = @fieldParentPtr("node", result.node);
(task.callback)(task);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/backend/epoll.zig
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ pub const Loop = struct {
/// This is the main callback for the threadpool to perform work
/// on completions for the loop.
fn thread_perform(t: *ThreadPool.Task) void {
const c = @fieldParentPtr(Completion, "task", t);
const c: *Completion = @fieldParentPtr("task", t);

// Do our task
c.task_result = c.perform();
Expand Down
2 changes: 1 addition & 1 deletion src/backend/iocp.zig
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ pub const Loop = struct {
continue;
}

break :completion @fieldParentPtr(Completion, "overlapped", overlapped_ptr.?);
break :completion @fieldParentPtr("overlapped", overlapped_ptr.?);
} else completion: {
// JobObjects are a special case where the OVERLAPPED_ENTRY fields are interpreted differently.
// When JOBOBJECT_ASSOCIATE_COMPLETION_PORT is used, lpOverlapped actually contains the message
Expand Down
2 changes: 1 addition & 1 deletion src/backend/kqueue.zig
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ pub const Loop = struct {
/// This is the main callback for the threadpool to perform work
/// on completions for the loop.
fn thread_perform(t: *ThreadPool.Task) void {
const c = @fieldParentPtr(Completion, "task", t);
const c: *Completion = @fieldParentPtr("task", t);

// Do our task
c.result = c.perform(null);
Expand Down
4 changes: 2 additions & 2 deletions src/build/ScdocStep.zig
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub fn init(builder: *Build) ScdocStep {
fn make(step: *std.Build.Step, progress: *std.Progress.Node) !void {
_ = progress;

const self = @fieldParentPtr(ScdocStep, "step", step);
const self: *ScdocStep = @fieldParentPtr("step", step);

// Create our cache path
// TODO(mitchellh): ideally this would be pure zig
Expand Down Expand Up @@ -129,7 +129,7 @@ const InstallStep = struct {
}

fn make(step: *Step, progress: *std.Progress.Node) !void {
const self = @fieldParentPtr(InstallStep, "step", step);
const self: *InstallStep = @fieldParentPtr("step", step);

// Get our absolute output path
var path = self.scdoc.out_path;
Expand Down
6 changes: 3 additions & 3 deletions src/c_api.zig
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@ export fn xev_threadpool_task_init(
t.* = .{
.callback = (struct {
fn callback(inner_t: *xev.ThreadPool.Task) void {
@fieldParentPtr(
Task,
const task: *Task = @alignCast(@fieldParentPtr(
"data",
@as(*Task.Data, @ptrCast(inner_t)),
).c_callback(inner_t);
));
task.c_callback(inner_t);
}
}).callback,
};
Expand Down
2 changes: 1 addition & 1 deletion src/watcher/stream.zig
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub fn Writeable(comptime xev: type, comptime T: type, comptime options: Options
/// originally is from a write request. This is useful for getting
/// the WriteRequest back in a callback from queuedWrite.
pub fn from(c: *xev.Completion) *WriteRequest {
return @fieldParentPtr(WriteRequest, "completion", c);
return @fieldParentPtr("completion", c);
}
};

Expand Down