summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAndrew Clayton <a.clayton@nginx.com>2025-05-21 04:13:11 +0100
committerAndrew Clayton <a.clayton@nginx.com>2025-05-28 16:35:34 +0100
commit39f9121339559738cba5130c818e8920e1a2fa16 (patch)
tree47a9fa136b6e5c127fb6779e6d94de0f13ce5fcd /src
parent4fcbe9caf6639fa0fb5ca1663a5f32527b522580 (diff)
downloadunit-39f9121339559738cba5130c818e8920e1a2fa16.tar.gz
unit-39f9121339559738cba5130c818e8920e1a2fa16.tar.bz2
Use NULL instead of 0 as null pointer constant
GCC 15 enabled "-Wzero-as-null-pointer-constant" for C, which checks for places where '0' has been used as a null pointer constant. This showed a few places in Unit where we were using '0' instead of the more correct NULL macro. E.g. $ make -j4 EXTRA_CFLAGS=-Wzero-as-null-pointer-constant ... src/nxt_buf.c: In function ‘nxt_buf_mmap_alloc’: src/nxt_buf.h:192:21: error: zero as null pointer constant [-Werror=zero-as-null-pointer-constant] 192 | (bm)->start = 0; \ | ^ src/nxt_buf.c:135:9: note: in expansion of macro ‘nxt_buf_mem_set_size’ 135 | nxt_buf_mem_set_size(&b->mem, size); | ^~~~~~~~~~~~~~~~~~~~ Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
Diffstat (limited to 'src')
-rw-r--r--src/nxt_buf.h2
-rw-r--r--src/nxt_unit.c2
-rw-r--r--src/python/nxt_python_asgi_http.c8
-rw-r--r--src/python/nxt_python_asgi_lifespan.c8
-rw-r--r--src/python/nxt_python_asgi_websocket.c8
-rw-r--r--src/python/nxt_python_wsgi.c8
-rw-r--r--src/ruby/nxt_ruby.c2
7 files changed, 19 insertions, 19 deletions
diff --git a/src/nxt_buf.h b/src/nxt_buf.h
index a561ef4e..2f2cbaa6 100644
--- a/src/nxt_buf.h
+++ b/src/nxt_buf.h
@@ -189,7 +189,7 @@ struct nxt_buf_s {
#define nxt_buf_mem_set_size(bm, size) \
do { \
- (bm)->start = 0; \
+ (bm)->start = NULL; \
(bm)->end = (void *) size; \
} while (0)
diff --git a/src/nxt_unit.c b/src/nxt_unit.c
index 2f399678..7d523beb 100644
--- a/src/nxt_unit.c
+++ b/src/nxt_unit.c
@@ -716,7 +716,7 @@ nxt_unit_ctx_init(nxt_unit_impl_t *lib, nxt_unit_ctx_impl_t *ctx_impl,
ctx_impl->req.req.unit = &lib->unit;
ctx_impl->read_port = NULL;
- ctx_impl->requests.slot = 0;
+ ctx_impl->requests.slot = NULL;
return NXT_UNIT_OK;
}
diff --git a/src/python/nxt_python_asgi_http.c b/src/python/nxt_python_asgi_http.c
index fc489bc1..27b3e0e0 100644
--- a/src/python/nxt_python_asgi_http.c
+++ b/src/python/nxt_python_asgi_http.c
@@ -45,10 +45,10 @@ static PyObject *nxt_py_asgi_http_done(PyObject *self, PyObject *future);
static PyMethodDef nxt_py_asgi_http_methods[] = {
- { "receive", nxt_py_asgi_http_receive, METH_NOARGS, 0 },
- { "send", nxt_py_asgi_http_send, METH_O, 0 },
- { "_done", nxt_py_asgi_http_done, METH_O, 0 },
- { NULL, NULL, 0, 0 }
+ { "receive", nxt_py_asgi_http_receive, METH_NOARGS, NULL },
+ { "send", nxt_py_asgi_http_send, METH_O, NULL },
+ { "_done", nxt_py_asgi_http_done, METH_O, NULL },
+ {}
};
static PyAsyncMethods nxt_py_asgi_async_methods = {
diff --git a/src/python/nxt_python_asgi_lifespan.c b/src/python/nxt_python_asgi_lifespan.c
index 041cca21..8ef78377 100644
--- a/src/python/nxt_python_asgi_lifespan.c
+++ b/src/python/nxt_python_asgi_lifespan.c
@@ -48,10 +48,10 @@ static void nxt_py_asgi_lifespan_dealloc(PyObject *self);
static PyMethodDef nxt_py_asgi_lifespan_methods[] = {
- { "receive", nxt_py_asgi_lifespan_receive, METH_NOARGS, 0 },
- { "send", nxt_py_asgi_lifespan_send, METH_O, 0 },
- { "_done", nxt_py_asgi_lifespan_done, METH_O, 0 },
- { NULL, NULL, 0, 0 }
+ { "receive", nxt_py_asgi_lifespan_receive, METH_NOARGS, NULL },
+ { "send", nxt_py_asgi_lifespan_send, METH_O, NULL },
+ { "_done", nxt_py_asgi_lifespan_done, METH_O, NULL },
+ {}
};
static PyMemberDef nxt_py_asgi_lifespan_members[] = {
diff --git a/src/python/nxt_python_asgi_websocket.c b/src/python/nxt_python_asgi_websocket.c
index ab1d0324..e3c37e74 100644
--- a/src/python/nxt_python_asgi_websocket.c
+++ b/src/python/nxt_python_asgi_websocket.c
@@ -70,10 +70,10 @@ static PyObject *nxt_py_asgi_websocket_done(PyObject *self, PyObject *future);
static PyMethodDef nxt_py_asgi_websocket_methods[] = {
- { "receive", nxt_py_asgi_websocket_receive, METH_NOARGS, 0 },
- { "send", nxt_py_asgi_websocket_send, METH_O, 0 },
- { "_done", nxt_py_asgi_websocket_done, METH_O, 0 },
- { NULL, NULL, 0, 0 }
+ { "receive", nxt_py_asgi_websocket_receive, METH_NOARGS, NULL },
+ { "send", nxt_py_asgi_websocket_send, METH_O, NULL },
+ { "_done", nxt_py_asgi_websocket_done, METH_O, NULL },
+ {}
};
static PyAsyncMethods nxt_py_asgi_async_methods = {
diff --git a/src/python/nxt_python_wsgi.c b/src/python/nxt_python_wsgi.c
index c621097e..ec9fefca 100644
--- a/src/python/nxt_python_wsgi.c
+++ b/src/python/nxt_python_wsgi.c
@@ -108,10 +108,10 @@ static PyMethodDef nxt_py_write_method[] = {
static PyMethodDef nxt_py_input_methods[] = {
- { "read", (PyCFunction) nxt_py_input_read, METH_VARARGS, 0 },
- { "readline", (PyCFunction) nxt_py_input_readline, METH_VARARGS, 0 },
- { "readlines", (PyCFunction) nxt_py_input_readlines, METH_VARARGS, 0 },
- { NULL, NULL, 0, 0 }
+ { "read", (PyCFunction) nxt_py_input_read, METH_VARARGS, NULL },
+ { "readline", (PyCFunction) nxt_py_input_readline, METH_VARARGS, NULL },
+ { "readlines", (PyCFunction) nxt_py_input_readlines, METH_VARARGS, NULL },
+ {}
};
diff --git a/src/ruby/nxt_ruby.c b/src/ruby/nxt_ruby.c
index 27b868fe..717816df 100644
--- a/src/ruby/nxt_ruby.c
+++ b/src/ruby/nxt_ruby.c
@@ -1081,7 +1081,7 @@ nxt_ruby_rack_result_body(nxt_unit_request_info_t *req, VALUE result)
}
} else if (rb_respond_to(body, rb_intern("each"))) {
- rb_block_call(body, rb_intern("each"), 0, 0,
+ rb_block_call(body, rb_intern("each"), 0, NULL,
nxt_ruby_rack_result_body_each, (VALUE) (uintptr_t) req);
} else {