Use NGX_CONF_OK in some function return checks.

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>
This commit is contained in:
Andrew Clayton 2025-05-21 22:19:32 +01:00 committed by Roman Arutyunyan
parent ba917b1360
commit c370ac8a51
11 changed files with 11 additions and 11 deletions

View 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, if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
&prev->types_keys, &prev->types, &prev->types_keys, &prev->types,
ngx_http_html_default_types) ngx_http_html_default_types)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
&prev->types_keys, &prev->types, &prev->types_keys, &prev->types,
ngx_http_charset_default_types) ngx_http_charset_default_types)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
prev->upstream.temp_path, prev->upstream.temp_path,
&ngx_http_fastcgi_temp_path) &ngx_http_fastcgi_temp_path)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
&prev->types_keys, &prev->types, &prev->types_keys, &prev->types,
ngx_http_html_default_types) ngx_http_html_default_types)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View File

@ -3859,7 +3859,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, if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
prev->upstream.temp_path, prev->upstream.temp_path,
&ngx_http_proxy_temp_path) &ngx_http_proxy_temp_path)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
prev->upstream.temp_path, prev->upstream.temp_path,
&ngx_http_scgi_temp_path) &ngx_http_scgi_temp_path)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
&prev->types_keys, &prev->types, &prev->types_keys, &prev->types,
ngx_http_html_default_types) ngx_http_html_default_types)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
&prev->types_keys, &prev->types, &prev->types_keys, &prev->types,
ngx_http_html_default_types) ngx_http_html_default_types)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_conf_merge_path_value(cf, &conf->upstream.temp_path,
prev->upstream.temp_path, prev->upstream.temp_path,
&ngx_http_uwsgi_temp_path) &ngx_http_uwsgi_temp_path)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View 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, if (ngx_http_merge_types(cf, &conf->types_keys, &conf->types,
&prev->types_keys, &prev->types, &prev->types_keys, &prev->types,
ngx_http_xslt_default_types) ngx_http_xslt_default_types)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }

View File

@ -3931,7 +3931,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, if (ngx_conf_merge_path_value(cf, &conf->client_body_temp_path,
prev->client_body_temp_path, prev->client_body_temp_path,
&ngx_http_client_temp_path) &ngx_http_client_temp_path)
!= NGX_OK) != NGX_CONF_OK)
{ {
return NGX_CONF_ERROR; return NGX_CONF_ERROR;
} }