1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-10 17:42:29 +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/access/nbtree/nbtinsert.c,v 1.110 2003/12/21 01:23:06 tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.111 2004/01/07 18:56:24 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -1186,7 +1186,7 @@ _bt_insert_parent(Relation rel,
{
Buffer rootbuf;
Assert(stack == (BTStack) NULL);
Assert(stack == NULL);
Assert(is_only);
/* create a new root node and update the metapage */
rootbuf = _bt_newroot(rel, buf, rbuf);
@@ -1206,7 +1206,7 @@ _bt_insert_parent(Relation rel,
BTItem ritem;
Buffer pbuf;
if (stack == (BTStack) NULL)
if (stack == NULL)
{
BTPageOpaque lpageop;

View File

@@ -12,7 +12,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.108 2003/11/29 19:51:40 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtree.c,v 1.109 2004/01/07 18:56:24 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -396,7 +396,7 @@ btrescan(PG_FUNCTION_ARGS)
if (scan->numberOfKeys > 0)
so->keyData = (ScanKey) palloc(scan->numberOfKeys * sizeof(ScanKeyData));
else
so->keyData = (ScanKey) NULL;
so->keyData = NULL;
scan->opaque = so;
}
@@ -459,7 +459,7 @@ btendscan(PG_FUNCTION_ARGS)
ItemPointerSetInvalid(iptr);
}
if (so->keyData != (ScanKey) NULL)
if (so->keyData != NULL)
pfree(so->keyData);
pfree(so);

View File

@@ -36,7 +36,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.79 2003/11/29 19:51:40 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtsort.c,v 1.80 2004/01/07 18:56:24 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -257,7 +257,7 @@ _bt_pagestate(Relation index, uint32 level)
/* create initial page */
_bt_blnewpage(index, &(state->btps_buf), &(state->btps_page), level);
state->btps_minkey = (BTItem) NULL;
state->btps_minkey = NULL;
/* initialize lastoff so first item goes into P_FIRSTKEY */
state->btps_lastoff = P_HIKEY;
state->btps_level = level;
@@ -267,7 +267,7 @@ _bt_pagestate(Relation index, uint32 level)
else
state->btps_full = PageGetPageSize(state->btps_page) / 10;
/* no parent level, yet */
state->btps_next = (BTPageState *) NULL;
state->btps_next = NULL;
return state;
}
@@ -444,7 +444,7 @@ _bt_buildadd(Relation index, BTPageState *state, BTItem bti)
* we don't have a parent, we have to create one; this adds a new
* btree level.
*/
if (state->btps_next == (BTPageState *) NULL)
if (state->btps_next == NULL)
state->btps_next = _bt_pagestate(index, state->btps_level + 1);
Assert(state->btps_minkey != NULL);
@@ -520,7 +520,7 @@ _bt_uppershutdown(Relation index, BTPageState *state)
/*
* Each iteration of this loop completes one more level of the tree.
*/
for (s = state; s != (BTPageState *) NULL; s = s->btps_next)
for (s = state; s != NULL; s = s->btps_next)
{
BlockNumber blkno;
BTPageOpaque opaque;
@@ -536,7 +536,7 @@ _bt_uppershutdown(Relation index, BTPageState *state)
* key. This may cause the last page of the parent level to
* split, but that's not a problem -- we haven't gotten to it yet.
*/
if (s->btps_next == (BTPageState *) NULL)
if (s->btps_next == NULL)
{
opaque->btpo_flags |= BTP_ROOT;
rootblkno = blkno;

View File

@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.57 2003/11/29 19:51:40 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtutils.c,v 1.58 2004/01/07 18:56:24 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -126,7 +126,7 @@ _bt_freestack(BTStack stack)
{
BTStack ostack;
while (stack != (BTStack) NULL)
while (stack != NULL)
{
ostack = stack;
stack = stack->bts_parent;

View File

@@ -8,7 +8,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.9 2003/12/14 00:34:47 neilc Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtxlog.c,v 1.10 2004/01/07 18:56:24 neilc Exp $
*
*-------------------------------------------------------------------------
*/
@@ -995,7 +995,7 @@ btree_xlog_cleanup(void)
/* if the two pages are all of their level, it's a only-page split */
is_only = P_LEFTMOST(lpageop) && P_RIGHTMOST(rpageop);
_bt_insert_parent(reln, lbuf, rbuf, (BTStack) NULL,
_bt_insert_parent(reln, lbuf, rbuf, NULL,
split->is_root, is_only);
}
incomplete_splits = NIL;