mirror of
https://github.com/nginx/nginx.git
synced 2025-06-07 17:52:38 +08:00
Use NULL instead of 0 for null pointer constant
There were a few random places where 0 was being used as a null pointer constant. We have a NULL macro for this very purpose, use it. There is also some interest in actually deprecating the use of 0 as a null pointer constant in C. 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> Signed-off-by: Andrew Clayton <a.clayton@nginx.com>
This commit is contained in:
parent
09b07d3366
commit
00c08b8acd
@ -207,7 +207,7 @@ ngx_thread_pool_exit_handler(void *data, ngx_log_t *log)
|
|||||||
|
|
||||||
*lock = 0;
|
*lock = 0;
|
||||||
|
|
||||||
pthread_exit(0);
|
pthread_exit(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ ngx_ssl_cache_pkey_create(ngx_ssl_cache_key_t *id, char **err, void *data)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkey = ENGINE_load_private_key(engine, (char *) last, 0, 0);
|
pkey = ENGINE_load_private_key(engine, (char *) last, NULL, NULL);
|
||||||
|
|
||||||
if (pkey == NULL) {
|
if (pkey == NULL) {
|
||||||
*err = "ENGINE_load_private_key() failed";
|
*err = "ENGINE_load_private_key() failed";
|
||||||
|
@ -964,7 +964,7 @@ ngx_quic_handle_payload(ngx_connection_t *c, ngx_quic_header_t *pkt)
|
|||||||
qc = ngx_quic_get_connection(c);
|
qc = ngx_quic_get_connection(c);
|
||||||
|
|
||||||
qc->error = 0;
|
qc->error = 0;
|
||||||
qc->error_reason = 0;
|
qc->error_reason = NULL;
|
||||||
|
|
||||||
c->log->action = "decrypting packet";
|
c->log->action = "decrypting packet";
|
||||||
|
|
||||||
|
@ -304,7 +304,7 @@ ngx_http_gunzip_filter_inflate_start(ngx_http_request_t *r,
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
ctx->zstream.next_in = Z_NULL;
|
ctx->zstream.next_in = NULL;
|
||||||
ctx->zstream.avail_in = 0;
|
ctx->zstream.avail_in = 0;
|
||||||
|
|
||||||
ctx->zstream.zalloc = ngx_http_gunzip_filter_alloc;
|
ctx->zstream.zalloc = ngx_http_gunzip_filter_alloc;
|
||||||
|
@ -820,7 +820,7 @@ ngx_http_ssi_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (prm = cmd->params; prm->name.len; prm++) {
|
for (prm = cmd->params; prm->name.len; prm++) {
|
||||||
if (prm->mandatory && params[prm->index] == 0) {
|
if (prm->mandatory && params[prm->index] == NULL) {
|
||||||
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
||||||
"mandatory \"%V\" parameter is absent "
|
"mandatory \"%V\" parameter is absent "
|
||||||
"in \"%V\" SSI command",
|
"in \"%V\" SSI command",
|
||||||
|
@ -43,7 +43,7 @@ ngx_timezone_update(void)
|
|||||||
struct tm *t;
|
struct tm *t;
|
||||||
char buf[4];
|
char buf[4];
|
||||||
|
|
||||||
s = time(0);
|
s = time(NULL);
|
||||||
|
|
||||||
t = localtime(&s);
|
t = localtime(&s);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user