Skip to content

Commit e6e78a9

Browse files
committed
fix: compile errors with clang 21
Upgrade to nixpkgs 2025-11-13 to obtain clang 21. * compile with Wdangling-assignment from clang 21 * fix EREPORT_CURL_MULTI_SETOPT compile failures due to type mismatch
1 parent e0e6d08 commit e6e78a9

File tree

4 files changed

+26
-19
lines changed

4 files changed

+26
-19
lines changed

shell.nix

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
with import (builtins.fetchTarball {
2-
name = "25.05";
3-
url = "https://github.com/NixOS/nixpkgs/archive/refs/tags/25.05.tar.gz";
4-
sha256 = "sha256:1915r28xc4znrh2vf4rrjnxldw2imysz819gzhk9qlrkqanmfsxd";
2+
name = "2025-11-13";
3+
url = "https://github.com/NixOS/nixpkgs/archive/91c9a64ce2a84e648d0cf9671274bb9c2fb9ba60.tar.gz";
4+
sha256 = "sha256:19myp93spfsf5x62k6ncan7020bmbn80kj4ywcykqhb9c3q8fdr1";
55
}) {};
66
mkShell {
77
buildInputs =

src/core.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -273,21 +273,24 @@ void insert_response(CurlHandle *handle, CURLcode curl_return_code) {
273273
vals[5] = BoolGetDatum(false);
274274
nulls[5] = ' ';
275275
} else {
276-
bool timed_out = curl_return_code == CURLE_OPERATION_TIMEDOUT;
277-
char *error_msg = NULL;
278-
279-
if (timed_out) {
280-
error_msg = detailed_timeout_strerror(handle->ez_handle, handle->timeout_milliseconds).msg;
281-
} else {
282-
error_msg = (char *)curl_easy_strerror(curl_return_code);
283-
}
276+
bool timed_out = curl_return_code == CURLE_OPERATION_TIMEDOUT;
284277

285278
vals[5] = BoolGetDatum(timed_out);
286279
nulls[5] = ' ';
287280

288-
if (error_msg) {
289-
vals[6] = CStringGetTextDatum(error_msg);
281+
if (timed_out) {
282+
curl_timeout_msg timeout_msg =
283+
detailed_timeout_strerror(handle->ez_handle, handle->timeout_milliseconds);
284+
285+
vals[6] = CStringGetTextDatum(timeout_msg.msg);
290286
nulls[6] = ' ';
287+
} else {
288+
const char *error_msg = curl_easy_strerror(curl_return_code);
289+
290+
if (error_msg) {
291+
vals[6] = CStringGetTextDatum(error_msg);
292+
nulls[6] = ' ';
293+
}
291294
}
292295
}
293296

src/event.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ void ev_monitor_close(WorkerState *wstate) {
2727
close(timerfd);
2828
}
2929

30-
int multi_timer_cb(__attribute__((unused)) CURLM *multi, long timeout_ms, WorkerState *wstate) {
30+
int multi_timer_cb(__attribute__((unused)) CURLM *multi, long timeout_ms, void *userp) {
31+
WorkerState *wstate = (WorkerState *)userp;
3132
elog(DEBUG2, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms);
3233

3334
if (!timer_created) {
@@ -72,7 +73,8 @@ int multi_timer_cb(__attribute__((unused)) CURLM *multi, long timeout_ms, Worker
7273
}
7374

7475
int multi_socket_cb(__attribute__((unused)) CURL *easy, curl_socket_t sockfd, int what,
75-
WorkerState *wstate, void *socketp) {
76+
void *userp, void *socketp) {
77+
WorkerState *wstate = (WorkerState *)userp;
7678
static char *whatstrs[] = {"NONE", "CURL_POLL_IN", "CURL_POLL_OUT", "CURL_POLL_INOUT",
7779
"CURL_POLL_REMOVE"};
7880
elog(DEBUG2, "multi_socket_cb: sockfd %d received %s", sockfd, whatstrs[what]);
@@ -145,7 +147,8 @@ void ev_monitor_close(WorkerState *wstate) {
145147
close(wstate->epfd);
146148
}
147149

148-
int multi_timer_cb(__attribute__((unused)) CURLM *multi, long timeout_ms, WorkerState *wstate) {
150+
int multi_timer_cb(__attribute__((unused)) CURLM *multi, long timeout_ms, void *userp) {
151+
WorkerState *wstate = (WorkerState *)userp;
149152
elog(DEBUG2, "multi_timer_cb: Setting timeout to %ld ms\n", timeout_ms);
150153
event timer_event;
151154
int id = 1;
@@ -172,7 +175,8 @@ int multi_timer_cb(__attribute__((unused)) CURLM *multi, long timeout_ms, Worker
172175
}
173176

174177
int multi_socket_cb(__attribute__((unused)) CURL *easy, curl_socket_t sockfd, int what,
175-
WorkerState *wstate, void *socketp) {
178+
void *userp, void *socketp) {
179+
WorkerState *wstate = (WorkerState *)userp;
176180
static char *whatstrs[] = {"NONE", "CURL_POLL_IN", "CURL_POLL_OUT", "CURL_POLL_INOUT",
177181
"CURL_POLL_REMOVE"};
178182
elog(DEBUG2, "multi_socket_cb: sockfd %d received %s", sockfd, whatstrs[what]);

src/event.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ typedef struct kevent event;
2929
int wait_event(int fd, event *events, size_t maxevents, int wait_milliseconds);
3030
int event_monitor(void);
3131
void ev_monitor_close(WorkerState *wstate);
32-
int multi_timer_cb(CURLM *multi, long timeout_ms, WorkerState *wstate);
33-
int multi_socket_cb(CURL *easy, curl_socket_t sockfd, int what, WorkerState *wstate, void *socketp);
32+
int multi_timer_cb(CURLM *multi, long timeout_ms, void *userp);
33+
int multi_socket_cb(CURL *easy, curl_socket_t sockfd, int what, void *userp, void *socketp);
3434
bool is_timer(event ev);
3535
int get_curl_event(event ev);
3636
int get_socket_fd(event ev);

0 commit comments

Comments
 (0)