|
fn descCopyHelper(src: *anyopaque, dst: *anyopaque) callconv(.c) void { |
|
const real_src: *Context = @ptrCast(@alignCast(src)); |
|
const real_dst: *Context = @ptrCast(@alignCast(dst)); |
|
inline for (captures_info.fields) |field| { |
|
if (field.type == objc.c.id) { |
|
_Block_object_assign( |
|
@ptrCast(&@field(real_dst, field.name)), |
|
@field(real_src, field.name), |
|
.object, |
|
); |
|
} |
|
} |
|
} |
this function must correspond to the signature of
|
copy_helper: *const fn (dst: *anyopaque, src: *anyopaque) callconv(.c) void, |
(as per
void (*copy_helper)(void *dst, void *src)
Its signature is instead fn (src: *anyopaque, dst: *anyopaque) callconv(.c) void – the parameters are swapped.
I could not find the definition of _Block_object_assign, but in its uses, the first argument does come from dst, the second comes from src, so the call in descCopyHelper seems to be correct.
zig-objc/src/block.zig
Lines 123 to 135 in f356ed0
this function must correspond to the signature of
zig-objc/src/block.zig
Line 260 in f356ed0
(as per
void (*copy_helper)(void *dst, void *src)Its signature is instead
fn (src: *anyopaque, dst: *anyopaque) callconv(.c) void– the parameters are swapped.I could not find the definition of
_Block_object_assign, but in its uses, the first argument does come fromdst, the second comes fromsrc, so the call indescCopyHelperseems to be correct.