1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

More janitorial work: remove the explicit casting of NULL literals to a

pointer type when it is not necessary to do so.

For future reference, casting NULL to a pointer type is only necessary
when (a) invoking a function AND either (b) the function has no prototype
OR (c) the function is a varargs function.
This commit is contained in:
Neil Conway
2004-01-07 18:56:30 +00:00
parent afca5d50dc
commit 192ad63bd7
71 changed files with 424 additions and 436 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execJunk.c,v 1.37 2003/11/29 19:51:48 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/executor/execJunk.c,v 1.38 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -267,7 +267,7 @@ ExecRemoveJunk(JunkFilter *junkfilter, TupleTableSlot *slot)
* Handle the trivial case first.
*/
if (cleanLength == 0)
return (HeapTuple) NULL;
return NULL;
/*
* Create the arrays that will hold the attribute values and the null

View File

@ -26,7 +26,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.224 2003/12/28 21:57:36 tgl Exp $
* $PostgreSQL: pgsql/src/backend/executor/execMain.c,v 1.225 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -782,7 +782,7 @@ InitPlan(QueryDesc *queryDesc, bool explainOnly)
*
* If EXPLAIN, skip creating the "into" relation.
*/
intoRelationDesc = (Relation) NULL;
intoRelationDesc = NULL;
if (do_select_into && !explainOnly)
{
@ -1076,7 +1076,7 @@ lnext: ;
*
* Also, extract all the junk information we need.
*/
if ((junkfilter = estate->es_junkFilter) != (JunkFilter *) NULL)
if ((junkfilter = estate->es_junkFilter) != NULL)
{
Datum datum;
HeapTuple newTuple;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.152 2003/12/18 22:23:42 tgl Exp $
* $PostgreSQL: pgsql/src/backend/executor/execQual.c,v 1.153 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -548,7 +548,7 @@ GetAttributeByNum(TupleTableSlot *slot,
if (!AttributeNumberIsValid(attrno))
elog(ERROR, "invalid attribute number %d", attrno);
if (isNull == (bool *) NULL)
if (isNull == NULL)
elog(ERROR, "a NULL isNull pointer was passed");
if (TupIsNull(slot))
@ -579,7 +579,7 @@ GetAttributeByName(TupleTableSlot *slot, char *attname, bool *isNull)
if (attname == NULL)
elog(ERROR, "invalid attribute name");
if (isNull == (bool *) NULL)
if (isNull == NULL)
elog(ERROR, "a NULL isNull pointer was passed");
if (TupIsNull(slot))
@ -3116,7 +3116,7 @@ ExecProject(ProjectionInfo *projInfo, ExprDoneCond *isDone)
* sanity checks
*/
if (projInfo == NULL)
return (TupleTableSlot *) NULL;
return NULL;
/*
* get the projection info we want

View File

@ -15,7 +15,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.74 2003/12/01 23:09:02 momjian Exp $
* $PostgreSQL: pgsql/src/backend/executor/execTuples.c,v 1.75 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -271,11 +271,11 @@ ExecAllocTableSlot(TupleTable table)
/* Make sure the allocated slot is valid (and empty) */
slot->type = T_TupleTableSlot;
slot->val = (HeapTuple) NULL;
slot->val = NULL;
slot->ttc_shouldFree = true;
slot->ttc_descIsNew = true;
slot->ttc_shouldFreeDesc = true;
slot->ttc_tupleDescriptor = (TupleDesc) NULL;
slot->ttc_tupleDescriptor = NULL;
slot->ttc_buffer = InvalidBuffer;
return slot;
@ -296,11 +296,11 @@ MakeTupleTableSlot(void)
TupleTableSlot *slot = makeNode(TupleTableSlot);
/* This should match ExecAllocTableSlot() */
slot->val = (HeapTuple) NULL;
slot->val = NULL;
slot->ttc_shouldFree = true;
slot->ttc_descIsNew = true;
slot->ttc_shouldFreeDesc = true;
slot->ttc_tupleDescriptor = (TupleDesc) NULL;
slot->ttc_tupleDescriptor = NULL;
slot->ttc_buffer = InvalidBuffer;
return slot;
@ -406,7 +406,7 @@ ExecClearTuple(TupleTableSlot *slot) /* slot in which to store tuple */
if (slot->ttc_shouldFree && oldtuple != NULL)
heap_freetuple(oldtuple);
slot->val = (HeapTuple) NULL;
slot->val = NULL;
slot->ttc_shouldFree = true; /* probably useless code... */

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.76 2003/11/29 19:51:48 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/executor/functions.c,v 1.77 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -47,7 +47,7 @@ typedef struct local_es
QueryDesc *qd; /* null unless status == RUN */
} execution_state;
#define LAST_POSTQUEL_COMMAND(es) ((es)->next == (execution_state *) NULL)
#define LAST_POSTQUEL_COMMAND(es) ((es)->next == NULL)
/*
@ -259,7 +259,7 @@ init_sql_fcache(FmgrInfo *finfo)
}
}
else
argOidVect = (Oid *) NULL;
argOidVect = NULL;
tmp = SysCacheGetAttr(PROCOID,
procedureTuple,
@ -304,7 +304,7 @@ postquel_getnext(execution_state *es)
if (es->qd->operation == CMD_UTILITY)
{
ProcessUtility(es->qd->parsetree->utilityStmt, es->qd->dest, NULL);
return (TupleTableSlot *) NULL;
return NULL;
}
/*
@ -358,7 +358,7 @@ postquel_sub_params(SQLFunctionCachePtr fcache,
paramLI[nargs].kind = PARAM_INVALID;
}
else
paramLI = (ParamListInfo) NULL;
paramLI = NULL;
if (fcache->paramLI)
pfree(fcache->paramLI);
@ -551,7 +551,7 @@ fmgr_sql(PG_FUNCTION_ARGS)
/*
* If we've gone through every command in this function, we are done.
*/
if (es == (execution_state *) NULL)
if (es == NULL)
{
/*
* Reset the execution states to start over again on next call.

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.59 2003/11/29 19:51:48 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/executor/nodeHashjoin.c,v 1.60 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -405,10 +405,10 @@ ExecInitHashJoin(HashJoin *node, EState *estate)
*/
hjstate->hj_hashdone = false;
hjstate->hj_HashTable = (HashJoinTable) NULL;
hjstate->hj_HashTable = NULL;
hjstate->hj_CurBucketNo = 0;
hjstate->hj_CurTuple = (HashJoinTuple) NULL;
hjstate->hj_CurTuple = NULL;
/*
* Deconstruct the hash clauses into outer and inner argument values,
@ -733,9 +733,9 @@ ExecReScanHashJoin(HashJoinState *node, ExprContext *exprCtxt)
/* Always reset intra-tuple state */
node->hj_CurBucketNo = 0;
node->hj_CurTuple = (HashJoinTuple) NULL;
node->hj_CurTuple = NULL;
node->js.ps.ps_OuterTupleSlot = (TupleTableSlot *) NULL;
node->js.ps.ps_OuterTupleSlot = NULL;
node->js.ps.ps_TupFromTlist = false;
node->hj_NeedNewOuter = true;
node->hj_MatchedOuter = false;

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.89 2004/01/06 04:31:01 tgl Exp $
* $PostgreSQL: pgsql/src/backend/executor/nodeIndexscan.c,v 1.90 2004/01/07 18:56:26 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@ -758,9 +758,9 @@ ExecInitIndexScan(IndexScan *node, EState *estate)
lossyflags = lfirst(indxlossy);
indxlossy = lnext(indxlossy);
n_keys = length(quals);
scan_keys = (n_keys <= 0) ? (ScanKey) NULL :
scan_keys = (n_keys <= 0) ? NULL :
(ScanKey) palloc(n_keys * sizeof(ScanKeyData));
run_keys = (n_keys <= 0) ? (ExprState **) NULL :
run_keys = (n_keys <= 0) ? NULL :
(ExprState **) palloc(n_keys * sizeof(ExprState *));
/*