]> git.kaiwu.me - nginx.git/commitdiff
Use NGX_CONF_OK in some function return checks.
authorAndrew Clayton <a.clayton@nginx.com>
Wed, 21 May 2025 21:19:32 +0000 (22:19 +0100)
committerSergey Kandaurov <s.kandaurov@f5.com>
Tue, 23 Dec 2025 18:40:33 +0000 (22:40 +0400)
The functions ngx_http_merge_types() & ngx_conf_merge_path_value()
return either NGX_CONF_OK aka NULL aka ((void *)0) (probably) or
NGX_CONF_ERROR aka ((void *)-1).

They don't return an integer constant which is what NGX_OK aka (0) is.

Lets use the right thing in the function return check.

This was found with -Wzero-as-null-pointer-constant which was enabled
for C in GCC 15 (not enabled with Wall or Wextra... yet).

Link: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117059>

src/http/modules/ngx_http_addition_filter_module.c
src/http/modules/ngx_http_charset_filter_module.c
src/http/modules/ngx_http_fastcgi_module.c
src/http/modules/ngx_http_gzip_filter_module.c
src/http/modules/ngx_http_proxy_module.c
src/http/modules/ngx_http_scgi_module.c
src/http/modules/ngx_http_ssi_filter_module.c
src/http/modules/ngx_http_sub_filter_module.c
src/http/modules/ngx_http_uwsgi_module.c
src/http/modules/ngx_http_xslt_filter_module.c
src/http/ngx_http_core_module.c

index e546f0d60b80471d24a48dff40dfe47104e4c8ea..040244c7e580feeab5f182fb58a6e9ee972b439d 100644 (file)
@@ -245,7 +245,7 @@ ngx_http_addition_merge_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
                              &prev->types_keys, &prev->types,
                              ngx_http_html_default_types)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index d44da6233a17f70110ad9812499ca45d29edbb3b..48296004008e3553680627e0d03edc8baa360f63 100644 (file)
@@ -1564,7 +1564,7 @@ ngx_http_charset_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
                              &prev->types_keys, &prev->types,
                              ngx_http_charset_default_types)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index a41b496dc8f6c0c7b704114007ab01014ca97c44..6b197734007e1de405e3483fe43b6fcb1afe2f2b 100644 (file)
@@ -3130,7 +3130,7 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
                               prev->upstream.temp_path,
                               &ngx_http_fastcgi_temp_path)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 7113df695aafc245f117661c79685f43c7991962..dac21bb1897a238a79229f6048bc581fee43ba46 100644 (file)
@@ -1115,7 +1115,7 @@ ngx_http_gzip_merge_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
                              &prev->types_keys, &prev->types,
                              ngx_http_html_default_types)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index d4c5abf62582602b4d6845b2e8ae89ce201c6c4b..7ee5ff3e878c6f278931a8110baedd90ab552137 100644 (file)
@@ -3844,7 +3844,7 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
                               prev->upstream.temp_path,
                               &ngx_http_proxy_temp_path)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 9023a36e49c54396f959f83956d2641a6c5f030d..49977b07b8f8894d1a4fa4553e5175b7469e6122 100644 (file)
@@ -1543,7 +1543,7 @@ ngx_http_scgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
                                   prev->upstream.temp_path,
                                   &ngx_http_scgi_temp_path)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 47068f7550eb8fca81232bc0e6d4f4eaa07d36c9..c862be05a59781b773b262d0c37d8f8332ea48b4 100644 (file)
@@ -2942,7 +2942,7 @@ ngx_http_ssi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
                              &prev->types_keys, &prev->types,
                              ngx_http_html_default_types)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 456bb27e3047cefe237cb2a5bb648633f8e8a127..b50a25235c267b63ba38b7768f821383c1dda42a 100644 (file)
@@ -901,7 +901,7 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
                              &prev->types_keys, &prev->types,
                              ngx_http_html_default_types)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 51a861d9aeb95b0c9899670e04e71436aeae7c73..c1d0035cc8b5cb7bf0138490ac51843c4a62de26 100644 (file)
@@ -1803,7 +1803,7 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
                                   prev->upstream.temp_path,
                                   &ngx_http_uwsgi_temp_path)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 8afd656af444f2a5840abbad31c7670e53c2bfc6..4e6e1b99d243e6b34bae80418b17d55c6e81662c 100644 (file)
@@ -1112,7 +1112,7 @@ ngx_http_xslt_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
                              &prev->types_keys, &prev->types,
                              ngx_http_xslt_default_types)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }
index 92c3eae8a153ae016412e829d7debb447223e3f1..816af4fd3eedf876dd2eaf678774208ce40de48c 100644 (file)
@@ -3892,7 +3892,7 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     if (ngx_conf_merge_path_value(cf, &conf->client_body_temp_path,
                               prev->client_body_temp_path,
                               &ngx_http_client_temp_path)
-        != NGX_OK)
+        != NGX_CONF_OK)
     {
         return NGX_CONF_ERROR;
     }