]> git.kaiwu.me - nginx.git/commitdiff
Events: fixed -Wzero-as-null-pointer-constant warnings in kqueue.
authorSergey Kandaurov <pluknet@nginx.com>
Tue, 8 Jul 2025 18:45:33 +0000 (22:45 +0400)
committerpluknet <pluknet@nginx.com>
Fri, 11 Jul 2025 12:25:51 +0000 (16:25 +0400)
The kevent udata field is special in that we maintain compatibility
with NetBSD versions that predate using the "void *" type.

The fix is to cast to intermediate uintptr_t that is casted back to
"void *" where appropriate.

src/event/modules/ngx_kqueue_module.c

index 9c7244c4587ad26fe78fdb7d80b31da4fb56210c..fb8a6527c4a6eab5dd0565f610399102dc1d406e 100644 (file)
@@ -191,7 +191,7 @@ ngx_kqueue_init(ngx_cycle_t *cycle, ngx_msec_t timer)
         kev.flags = EV_ADD|EV_ENABLE;
         kev.fflags = 0;
         kev.data = timer;
-        kev.udata = 0;
+        kev.udata = NGX_KQUEUE_UDATA_T (uintptr_t) 0;
 
         ts.tv_sec = 0;
         ts.tv_nsec = 0;
@@ -237,7 +237,7 @@ ngx_kqueue_notify_init(ngx_log_t *log)
     notify_kev.data = 0;
     notify_kev.flags = EV_ADD|EV_CLEAR;
     notify_kev.fflags = 0;
-    notify_kev.udata = 0;
+    notify_kev.udata = NGX_KQUEUE_UDATA_T (uintptr_t) 0;
 
     if (kevent(ngx_kqueue, &notify_kev, 1, NULL, 0, NULL) == -1) {
         ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,