mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 00:04:53 -05:00
Replace pointer comparisons and assignments to literal zero with NULL
While 0 is technically correct, NULL is the semantically appropriate choice for pointers. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://www.postgresql.org/message-id/aS1AYnZmuRZ8g%2B5G%40ip-10-97-1-34.eu-west-3.compute.internal
This commit is contained in:
parent
376c649634
commit
ec782f56b0
@ -204,7 +204,7 @@ copyObjectImpl(const void *from)
|
||||
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d", (int) nodeTag(from));
|
||||
retval = 0; /* keep compiler quiet */
|
||||
retval = NULL; /* keep compiler quiet */
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -3391,7 +3391,7 @@ LaunchMissingBackgroundProcesses(void)
|
||||
Shutdown <= SmartShutdown)
|
||||
{
|
||||
WalReceiverPMChild = StartChildProcess(B_WAL_RECEIVER);
|
||||
if (WalReceiverPMChild != 0)
|
||||
if (WalReceiverPMChild != NULL)
|
||||
WalReceiverRequested = false;
|
||||
/* else leave the flag set, so we'll try again later */
|
||||
}
|
||||
|
||||
@ -1222,10 +1222,10 @@ pg_newlocale_from_collation(Oid collid)
|
||||
* Make sure cache entry is marked invalid, in case we fail before
|
||||
* setting things.
|
||||
*/
|
||||
cache_entry->locale = 0;
|
||||
cache_entry->locale = NULL;
|
||||
}
|
||||
|
||||
if (cache_entry->locale == 0)
|
||||
if (cache_entry->locale == NULL)
|
||||
{
|
||||
cache_entry->locale = create_pg_locale(collid, CollationCacheContext);
|
||||
}
|
||||
|
||||
@ -5161,7 +5161,7 @@ interval_trunc(PG_FUNCTION_ARGS)
|
||||
errmsg("unit \"%s\" not supported for type %s",
|
||||
lowunits, format_type_be(INTERVALOID)),
|
||||
(val == DTK_WEEK) ? errdetail("Months usually have fractional weeks.") : 0));
|
||||
result = 0;
|
||||
result = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -509,7 +509,7 @@ ecpg_freeStmtCacheEntry(int lineno, int compat,
|
||||
if (entry->ecpgQuery)
|
||||
{
|
||||
ecpg_free(entry->ecpgQuery);
|
||||
entry->ecpgQuery = 0;
|
||||
entry->ecpgQuery = NULL;
|
||||
}
|
||||
|
||||
return entNo;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user