From dc12c6b6e043692df2a917c142abb80a75ae98ec Mon Sep 17 00:00:00 2001 From: Dan Cojocaru Date: Sun, 18 Feb 2024 17:27:42 +0100 Subject: [PATCH] Modify curl setopt wrapper --- src/curl.zig | 4 ++-- src/departure.zig | 6 +++--- src/home.zig | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/curl.zig b/src/curl.zig index f28258c..8924b64 100644 --- a/src/curl.zig +++ b/src/curl.zig @@ -67,9 +67,9 @@ pub fn setopt_raw( pub fn setopt( self: *@This(), option: Option, - args: anytype, + arg: anytype, ) c_api.CURLcode { - return self.setopt_raw(@intFromEnum(option), args); + return self.setopt_raw(@intFromEnum(option), .{ arg }); } pub const Utils = struct { diff --git a/src/departure.zig b/src/departure.zig index 6600751..0a8b9f6 100644 --- a/src/departure.zig +++ b/src/departure.zig @@ -59,12 +59,12 @@ fn fetchThread(state: *AppState) !void { const url = try std.fmt.allocPrintZ(allocator, "{}", .{departures_uri}); defer allocator.free(url); - _ = curl.setopt(.url, .{url.ptr}); + _ = curl.setopt(.url, url.ptr); var result = std.ArrayList(u8).init(allocator); defer result.deinit(); - _ = curl.setopt(.write_function, .{Curl.Utils.array_list_append}); - _ = curl.setopt(.write_data, .{&result}); + _ = curl.setopt(.write_function, Curl.Utils.array_list_append); + _ = curl.setopt(.write_data, &result); const code = curl.perform(); std.debug.print("[departure/fetchThread] cURL Code: {}\n", .{code}); diff --git a/src/home.zig b/src/home.zig index 5fa2658..6396b2a 100644 --- a/src/home.zig +++ b/src/home.zig @@ -38,12 +38,12 @@ fn fetchThread(state: *AppState) !void { const url = try std.fmt.allocPrintZ(allocator, "{}", .{locations_uri}); defer allocator.free(url); - _ = curl.setopt(.url, .{url.ptr}); + _ = curl.setopt(.url, url.ptr); var result = std.ArrayList(u8).init(allocator); defer result.deinit(); - _ = curl.setopt(.write_function, .{Curl.Utils.array_list_append}); - _ = curl.setopt(.write_data, .{&result}); + _ = curl.setopt(.write_function, Curl.Utils.array_list_append); + _ = curl.setopt(.write_data, &result); const code = curl.perform(); std.debug.print("[home/fetchThread] cURL Code: {}\n", .{code});