diff --git a/examples/websockets/websockets.zig b/examples/websockets/websockets.zig index 050bfd6..1ad7dea 100644 --- a/examples/websockets/websockets.zig +++ b/examples/websockets/websockets.zig @@ -35,7 +35,7 @@ const ContextManager = struct { .allocator = allocator, .channel = channelName, .usernamePrefix = usernamePrefix, - .contexts = ContextList.init(allocator), + .contexts = ContextList.empty, }; } @@ -43,7 +43,7 @@ const ContextManager = struct { for (self.contexts.items) |ctx| { self.allocator.free(ctx.userName); } - self.contexts.deinit(); + self.contexts.deinit(self.allocator); } pub fn newContext(self: *ContextManager) !*Context { @@ -73,7 +73,7 @@ const ContextManager = struct { .context = ctx, }, }; - try self.contexts.append(ctx); + try self.contexts.append(self.allocator, ctx); return ctx; } }; diff --git a/src/websockets.zig b/src/websockets.zig index d6af3f4..bc57b75 100644 --- a/src/websockets.zig +++ b/src/websockets.zig @@ -63,7 +63,7 @@ pub fn Handler(comptime ContextType: type) type { } } - fn internal_on_message(handle: WsHandle, msg: fio.fio_str_info_s, is_text: u8) callconv(.C) void { + fn internal_on_message(handle: WsHandle, msg: fio.fio_str_info_s, is_text: u8) callconv(.c) void { const user_provided_settings: ?*WebSocketSettings = @as(?*WebSocketSettings, @ptrCast(@alignCast(fio.websocket_udata_get(handle)))); const message = msg.data[0..msg.len]; if (user_provided_settings) |settings| { @@ -75,7 +75,7 @@ pub fn Handler(comptime ContextType: type) type { } } - fn internal_on_open(handle: WsHandle) callconv(.C) void { + fn internal_on_open(handle: WsHandle) callconv(.c) void { const user_provided_settings: ?*WebSocketSettings = @as(?*WebSocketSettings, @ptrCast(@alignCast(fio.websocket_udata_get(handle)))); if (user_provided_settings) |settings| { if (settings.on_open) |on_open| { @@ -86,7 +86,7 @@ pub fn Handler(comptime ContextType: type) type { } } - fn internal_on_ready(handle: WsHandle) callconv(.C) void { + fn internal_on_ready(handle: WsHandle) callconv(.c) void { const user_provided_settings: ?*WebSocketSettings = @as(?*WebSocketSettings, @ptrCast(@alignCast(fio.websocket_udata_get(handle)))); if (user_provided_settings) |settings| { if (settings.on_ready) |on_ready| { @@ -97,7 +97,7 @@ pub fn Handler(comptime ContextType: type) type { } } - fn internal_on_shutdown(handle: WsHandle) callconv(.C) void { + fn internal_on_shutdown(handle: WsHandle) callconv(.c) void { const user_provided_settings: ?*WebSocketSettings = @as(?*WebSocketSettings, @ptrCast(@alignCast(fio.websocket_udata_get(handle)))); if (user_provided_settings) |settings| { if (settings.on_shutdown) |on_shutdown| { @@ -108,7 +108,7 @@ pub fn Handler(comptime ContextType: type) type { } } - fn internal_on_close(uuid: isize, udata: ?*anyopaque) callconv(.C) void { + fn internal_on_close(uuid: isize, udata: ?*anyopaque) callconv(.c) void { const user_provided_settings: ?*WebSocketSettings = @as(?*WebSocketSettings, @ptrCast(@alignCast(udata))); if (user_provided_settings) |settings| { if (settings.on_close) |on_close| { @@ -219,7 +219,7 @@ pub fn Handler(comptime ContextType: type) type { return ret; } - pub fn internal_subscription_on_message(handle: WsHandle, channel: fio.fio_str_info_s, message: fio.fio_str_info_s, udata: ?*anyopaque) callconv(.C) void { + pub fn internal_subscription_on_message(handle: WsHandle, channel: fio.fio_str_info_s, message: fio.fio_str_info_s, udata: ?*anyopaque) callconv(.c) void { if (udata) |p| { const args = @as(*SubscribeArgs, @ptrCast(@alignCast(p))); if (args.on_message) |on_message| { @@ -229,7 +229,7 @@ pub fn Handler(comptime ContextType: type) type { } } } - pub fn internal_subscription_on_unsubscribe(udata: ?*anyopaque) callconv(.C) void { + pub fn internal_subscription_on_unsubscribe(udata: ?*anyopaque) callconv(.c) void { if (udata) |p| { const args = @as(*SubscribeArgs, @ptrCast(@alignCast(p))); if (args.on_unsubscribe) |on_unsubscribe| {