Skip to content

Commit 661ab5d

Browse files
committed
fix: update to zig 0.14.0-dev.2435
1 parent 5c6e6cb commit 661ab5d

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

build.zig.zon

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// This field is optional.
88
// This is currently advisory only; Zig does not yet do anything
99
// with this value.
10-
.minimum_zig_version = "0.11.0",
10+
.minimum_zig_version = "0.14.0",
1111

1212
// Specifies the set of files and directories that are included in this package.
1313
// Only files and directories listed here are included in the `hash` that

src/main/zig/lib.zig

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,17 +106,18 @@ pub inline fn boolToJboolean(b: bool) jboolean {
106106
/// Exports all functions with C calling convention from the provided `func_struct` type to be
107107
/// accessible from Java using the JNI.
108108
pub fn exportJNI(comptime class_name: []const u8, comptime func_struct: type) void {
109-
inline for (@typeInfo(func_struct).Struct.decls) |decl| {
109+
inline for (@typeInfo(func_struct).@"struct".decls) |decl| {
110110
const func = comptime @field(func_struct, decl.name);
111111
const func_type = @TypeOf(func);
112112

113113
// If it is not a function, skip.
114-
if (!std.mem.startsWith(u8, @typeName(@TypeOf(func)), "fn")) {
114+
if (@typeInfo(func_type) != .@"fn") {
115115
continue;
116116
}
117117

118+
118119
// If it is not a function with calling convention .C, skip.
119-
if (@typeInfo(func_type).Fn.calling_convention != .C) {
120+
if (!@typeInfo(func_type).@"fn".calling_convention.eql(.c)) {
120121
continue;
121122
}
122123

@@ -127,7 +128,7 @@ pub fn exportJNI(comptime class_name: []const u8, comptime func_struct: type) vo
127128

128129
_ = comptime std.mem.replace(u8, tmp_name, ".", "_", export_name[0..]);
129130

130-
@export(func, .{
131+
@export(&func, .{
131132
.name = export_name[0..],
132133
.linkage = .strong,
133134
});
@@ -148,8 +149,8 @@ inline fn valueLen(comptime ArgsType: type) comptime_int {
148149
const args_type_info = @typeInfo(ArgsType);
149150

150151
return switch (args_type_info) {
151-
.Struct => args_type_info.Struct.fields.len,
152-
.Void => 0,
152+
.@"struct" => |s| s.fields.len,
153+
.@"void" => 0,
153154
else => 1,
154155
};
155156
}
@@ -170,7 +171,7 @@ pub fn toJValues(args: anytype) [valueLen(@TypeOf(args))]jvalue {
170171
const ArgsType = @TypeOf(args);
171172
const args_type_info = @typeInfo(ArgsType);
172173

173-
if (args_type_info != .Struct) {
174+
if (args_type_info != .@"struct") {
174175
return switch (ArgsType) {
175176
jboolean => [1]jvalue{.{ .z = args }},
176177
jbyte => [1]jvalue{.{ .b = args }},
@@ -190,7 +191,7 @@ pub fn toJValues(args: anytype) [valueLen(@TypeOf(args))]jvalue {
190191
};
191192
}
192193

193-
const fields = args_type_info.Struct.fields;
194+
const fields = args_type_info.@"struct".fields;
194195
var output: [fields.len]jvalue = undefined;
195196

196197
inline for (fields, 0..) |field, i| {

0 commit comments

Comments
 (0)