Skip to content

Commit d13d43e

Browse files
committed
fix: callconv(.C) -> callconv(.c)
the previous usage was removed
1 parent e20bb29 commit d13d43e

File tree

1 file changed

+20
-20
lines changed

1 file changed

+20
-20
lines changed

src/lib.zig

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub const ArithOperator = switch (lang) {
7676

7777
/// Type for C functions
7878
/// See https://www.lua.org/manual/5.4/manual.html#lua_CFunction for the protocol
79-
pub const CFn = *const fn (state: ?*LuaState) callconv(.C) c_int;
79+
pub const CFn = *const fn (state: ?*LuaState) callconv(.c) c_int;
8080

8181
/// Operations supported by `Lua.compare()`
8282
pub const CompareOperator = enum(u2) {
@@ -86,13 +86,13 @@ pub const CompareOperator = enum(u2) {
8686
};
8787

8888
/// Type for C userdata destructors
89-
pub const CUserdataDtorFn = *const fn (userdata: *anyopaque) callconv(.C) void;
89+
pub const CUserdataDtorFn = *const fn (userdata: *anyopaque) callconv(.c) void;
9090

9191
/// Type for C interrupt callback
92-
pub const CInterruptCallbackFn = *const fn (state: ?*LuaState, gc: c_int) callconv(.C) void;
92+
pub const CInterruptCallbackFn = *const fn (state: ?*LuaState, gc: c_int) callconv(.c) void;
9393

9494
/// Type for C useratom callback
95-
pub const CUserAtomCallbackFn = *const fn (str: [*c]const u8, len: usize) callconv(.C) i16;
95+
pub const CUserAtomCallbackFn = *const fn (str: [*c]const u8, len: usize) callconv(.c) i16;
9696

9797
/// The internal Lua debug structure
9898
const Debug = c.lua_Debug;
@@ -357,7 +357,7 @@ pub const FnReg = struct {
357357
pub const globals_index = c.LUA_GLOBALSINDEX;
358358

359359
/// Type for debugging hook functions
360-
pub const CHookFn = *const fn (state: ?*LuaState, ar: ?*Debug) callconv(.C) void;
360+
pub const CHookFn = *const fn (state: ?*LuaState, ar: ?*Debug) callconv(.c) void;
361361

362362
/// Specifies on which events the hook will be called
363363
pub const HookMask = packed struct {
@@ -401,7 +401,7 @@ pub const Integer = c.lua_Integer;
401401
pub const Context = isize;
402402

403403
/// Type for continuation functions
404-
pub const CContFn = *const fn (state: ?*LuaState, status: c_int, ctx: Context) callconv(.C) c_int;
404+
pub const CContFn = *const fn (state: ?*LuaState, status: c_int, ctx: Context) callconv(.c) c_int;
405405

406406
pub const Libs51 = packed struct {
407407
base: bool = false,
@@ -499,7 +499,7 @@ pub const mult_return = c.LUA_MULTRET;
499499
pub const Number = c.lua_Number;
500500

501501
/// The type of the reader function used by `Lua.load()`
502-
pub const CReaderFn = *const fn (state: ?*LuaState, data: ?*anyopaque, size: [*c]usize) callconv(.C) [*c]const u8;
502+
pub const CReaderFn = *const fn (state: ?*LuaState, data: ?*anyopaque, size: [*c]usize) callconv(.c) [*c]const u8;
503503

504504
/// The possible status of a call to `Lua.resumeThread`
505505
pub const ResumeStatus = enum(u1) {
@@ -563,12 +563,12 @@ pub const Unsigned = c.lua_Unsigned;
563563

564564
/// The type of warning functions used by Lua to emit warnings
565565
pub const CWarnFn = switch (lang) {
566-
.lua54 => *const fn (data: ?*anyopaque, msg: [*c]const u8, to_cont: c_int) callconv(.C) void,
566+
.lua54 => *const fn (data: ?*anyopaque, msg: [*c]const u8, to_cont: c_int) callconv(.c) void,
567567
else => @compileError("CWarnFn not defined"),
568568
};
569569

570570
/// The type of the writer function used by `Lua.dump()`
571-
pub const CWriterFn = *const fn (state: ?*LuaState, buf: ?*const anyopaque, size: usize, data: ?*anyopaque) callconv(.C) c_int;
571+
pub const CWriterFn = *const fn (state: ?*LuaState, buf: ?*const anyopaque, size: usize, data: ?*anyopaque) callconv(.c) c_int;
572572

573573
/// For bundling a parsed value with an arena allocator
574574
/// Copied from std.json.Parsed
@@ -592,7 +592,7 @@ pub const Lua = opaque {
592592

593593
/// Allows Lua to allocate memory using a Zig allocator passed in via data.
594594
/// See https://www.lua.org/manual/5.4/manual.html#lua_Alloc for more details
595-
fn alloc(data: ?*anyopaque, ptr: ?*anyopaque, osize: usize, nsize: usize) callconv(.C) ?*align(alignment) anyopaque {
595+
fn alloc(data: ?*anyopaque, ptr: ?*anyopaque, osize: usize, nsize: usize) callconv(.c) ?*align(alignment) anyopaque {
596596
// just like malloc() returns a pointer "which is suitably aligned for any built-in type",
597597
// the memory allocated by this function should also be aligned for any type that Lua may
598598
// desire to allocate. use the largest alignment for the target
@@ -5163,7 +5163,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
51635163
// CFn
51645164
Tuple(&.{*Lua}) => {
51655165
return struct {
5166-
fn inner(state: ?*LuaState) callconv(.C) c_int {
5166+
fn inner(state: ?*LuaState) callconv(.c) c_int {
51675167
// this is called by Lua, state should never be null
51685168
var lua: *Lua = @ptrCast(state.?);
51695169
if (has_error_union) {
@@ -5179,7 +5179,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
51795179
// CHookFn
51805180
Tuple(&.{ *Lua, Event, *DebugInfo }) => {
51815181
return struct {
5182-
fn inner(state: ?*LuaState, ar: ?*Debug) callconv(.C) void {
5182+
fn inner(state: ?*LuaState, ar: ?*Debug) callconv(.c) void {
51835183
// this is called by Lua, state should never be null
51845184
var lua: *Lua = @ptrCast(state.?);
51855185
var debug_info: DebugInfo = .{
@@ -5202,7 +5202,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
52025202
// CContFn
52035203
Tuple(&.{ *Lua, Status, Context }) => {
52045204
return struct {
5205-
fn inner(state: ?*LuaState, status: c_int, ctx: Context) callconv(.C) c_int {
5205+
fn inner(state: ?*LuaState, status: c_int, ctx: Context) callconv(.c) c_int {
52065206
// this is called by Lua, state should never be null
52075207
var lua: *Lua = @ptrCast(state.?);
52085208
if (has_error_union) {
@@ -5218,7 +5218,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
52185218
// CReaderFn
52195219
Tuple(&.{ *Lua, *anyopaque }) => {
52205220
return struct {
5221-
fn inner(state: ?*LuaState, data: ?*anyopaque, size: [*c]usize) callconv(.C) [*c]const u8 {
5221+
fn inner(state: ?*LuaState, data: ?*anyopaque, size: [*c]usize) callconv(.c) [*c]const u8 {
52225222
// this is called by Lua, state should never be null
52235223
var lua: *Lua = @ptrCast(state.?);
52245224
if (has_error_union) {
@@ -5247,15 +5247,15 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
52475247
// CUserdataDtorFn
52485248
Tuple(&.{*anyopaque}) => {
52495249
return struct {
5250-
fn inner(userdata: *anyopaque) callconv(.C) void {
5250+
fn inner(userdata: *anyopaque) callconv(.c) void {
52515251
return @call(.always_inline, function, .{userdata});
52525252
}
52535253
}.inner;
52545254
},
52555255
// CInterruptCallbackFn
52565256
Tuple(&.{ *Lua, i32 }) => {
52575257
return struct {
5258-
fn inner(state: ?*LuaState, gc: c_int) callconv(.C) void {
5258+
fn inner(state: ?*LuaState, gc: c_int) callconv(.c) void {
52595259
// this is called by Lua, state should never be null
52605260
var lua: *Lua = @ptrCast(state.?);
52615261
if (has_error_union) {
@@ -5271,7 +5271,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
52715271
// CUserAtomCallbackFn
52725272
Tuple(&.{[]const u8}) => {
52735273
return struct {
5274-
fn inner(str: [*c]const u8, len: usize) callconv(.C) i16 {
5274+
fn inner(str: [*c]const u8, len: usize) callconv(.c) i16 {
52755275
if (str) |s| {
52765276
const buf = s[0..len];
52775277
return @call(.always_inline, function, .{buf});
@@ -5283,7 +5283,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
52835283
// CWarnFn
52845284
Tuple(&.{ ?*anyopaque, []const u8, bool }) => {
52855285
return struct {
5286-
fn inner(data: ?*anyopaque, msg: [*c]const u8, to_cont: c_int) callconv(.C) void {
5286+
fn inner(data: ?*anyopaque, msg: [*c]const u8, to_cont: c_int) callconv(.c) void {
52875287
// warning messages emitted from Lua should be null-terminated for display
52885288
const message = std.mem.span(@as([*:0]const u8, @ptrCast(msg)));
52895289
@call(.always_inline, function, .{ data, message, to_cont != 0 });
@@ -5293,7 +5293,7 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) {
52935293
// CWriterFn
52945294
Tuple(&.{ *Lua, []const u8, *anyopaque }) => {
52955295
return struct {
5296-
fn inner(state: ?*LuaState, buf: ?*const anyopaque, size: usize, data: ?*anyopaque) callconv(.C) c_int {
5296+
fn inner(state: ?*LuaState, buf: ?*const anyopaque, size: usize, data: ?*anyopaque) callconv(.c) c_int {
52975297
// this is called by Lua, state should never be null
52985298
var lua: *Lua = @ptrCast(state.?);
52995299
const buffer = @as([*]const u8, @ptrCast(buf))[0..size];
@@ -5382,7 +5382,7 @@ pub fn exportFn(comptime name: []const u8, comptime func: anytype) CFn {
53825382
if (lang == .luau) @compileError("Luau does not support compiling or loading shared modules");
53835383

53845384
return struct {
5385-
fn luaopen(state: ?*LuaState) callconv(.C) c_int {
5385+
fn luaopen(state: ?*LuaState) callconv(.c) c_int {
53865386
const declaration = comptime wrap(func);
53875387

53885388
return @call(.always_inline, declaration, .{state});

0 commit comments

Comments
 (0)