diff options
author | Neil Conway <neilc@samurai.com> | 2004-01-07 18:56:30 +0000 |
---|---|---|
committer | Neil Conway <neilc@samurai.com> | 2004-01-07 18:56:30 +0000 |
commit | 192ad63bd765d448e91389c6ff1d75f8b18bb268 (patch) | |
tree | 85873642a16b5ac877dc443a681fe9249c210693 /src/backend/access | |
parent | afca5d50dc296580925b560fff0eb75bb48f0cbe (diff) | |
download | postgresql-192ad63bd765d448e91389c6ff1d75f8b18bb268.tar.gz postgresql-192ad63bd765d448e91389c6ff1d75f8b18bb268.zip |
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.
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/common/printtup.c | 4 | ||||
-rw-r--r-- | src/backend/access/gist/gist.c | 39 | ||||
-rw-r--r-- | src/backend/access/gist/gistget.c | 6 | ||||
-rw-r--r-- | src/backend/access/gist/gistscan.c | 38 | ||||
-rw-r--r-- | src/backend/access/hash/hash.c | 4 | ||||
-rw-r--r-- | src/backend/access/hash/hashscan.c | 12 | ||||
-rw-r--r-- | src/backend/access/heap/heapam.c | 10 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtinsert.c | 6 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtree.c | 6 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtsort.c | 12 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtutils.c | 4 | ||||
-rw-r--r-- | src/backend/access/nbtree/nbtxlog.c | 4 | ||||
-rw-r--r-- | src/backend/access/rtree/rtget.c | 6 | ||||
-rw-r--r-- | src/backend/access/rtree/rtproc.c | 4 | ||||
-rw-r--r-- | src/backend/access/rtree/rtree.c | 16 | ||||
-rw-r--r-- | src/backend/access/rtree/rtscan.c | 36 | ||||
-rw-r--r-- | src/backend/access/transam/varsup.c | 4 | ||||
-rw-r--r-- | src/backend/access/transam/xact.c | 8 |
18 files changed, 106 insertions, 113 deletions
diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index 0219ee6875c..664c884a712 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -9,7 +9,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.79 2003/11/29 19:51:39 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/common/printtup.c,v 1.80 2004/01/07 18:56:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -509,7 +509,7 @@ debugStartup(DestReceiver *self, int operation, TupleDesc typeinfo) * show the return type of the tuples */ for (i = 0; i < natts; ++i) - printatt((unsigned) i + 1, attinfo[i], (char *) NULL); + printatt((unsigned) i + 1, attinfo[i], NULL); printf("\t----\n"); } diff --git a/src/backend/access/gist/gist.c b/src/backend/access/gist/gist.c index 9923240287a..65a10490d1e 100644 --- a/src/backend/access/gist/gist.c +++ b/src/backend/access/gist/gist.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.106 2003/11/29 19:51:39 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gist.c,v 1.107 2004/01/07 18:56:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -45,10 +45,10 @@ */ #define FILLITEM(evp, isnullkey, okey, okeyb, rkey, rkeyb) do { \ if ( isnullkey ) { \ - gistentryinit((evp), rkey, r, (Page) NULL , \ + gistentryinit((evp), rkey, r, NULL, \ (OffsetNumber) 0, rkeyb, FALSE); \ } else { \ - gistentryinit((evp), okey, r, (Page) NULL, \ + gistentryinit((evp), okey, r, NULL, \ (OffsetNumber) 0, okeyb, FALSE); \ } \ } while(0) @@ -248,7 +248,7 @@ gistbuildCallback(Relation index, else { gistcentryinit(&buildstate->giststate, i, &tmpcentry, attdata[i], - (Relation) NULL, (Page) NULL, (OffsetNumber) 0, + NULL, NULL, (OffsetNumber) 0, -1 /* size is currently bogus */ , TRUE, FALSE); if (attdata[i] != tmpcentry.key && !(isAttByVal(&buildstate->giststate, i))) @@ -332,7 +332,7 @@ gistinsert(PG_FUNCTION_ARGS) else { gistcentryinit(&giststate, i, &tmpentry, datum[i], - (Relation) NULL, (Page) NULL, (OffsetNumber) 0, + NULL, NULL, (OffsetNumber) 0, -1 /* size is currently bogus */ , TRUE, FALSE); if (datum[i] != tmpentry.key && !(isAttByVal(&giststate, i))) compvec[i] = TRUE; @@ -695,7 +695,7 @@ gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate) gistdentryinit(giststate, j, &((GISTENTRY *) VARDATA(evec))[reallen], datum, - (Relation) NULL, (Page) NULL, (OffsetNumber) NULL, + NULL, NULL, (OffsetNumber) 0, ATTSIZE(datum, giststate->tupdesc, j + 1, IsNull), FALSE, IsNull); if ((!isAttByVal(giststate, j)) && ((GISTENTRY *) VARDATA(evec))[reallen].key != datum) @@ -717,7 +717,7 @@ gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate) { VARATT_SIZEP(evec) = 2 * sizeof(GISTENTRY) + VARHDRSZ; gistentryinit(((GISTENTRY *) VARDATA(evec))[1], - ((GISTENTRY *) VARDATA(evec))[0].key, r, (Page) NULL, + ((GISTENTRY *) VARDATA(evec))[0].key, r, NULL, (OffsetNumber) 0, ((GISTENTRY *) VARDATA(evec))[0].bytes, FALSE); } @@ -732,7 +732,7 @@ gistunion(Relation r, IndexTuple *itvec, int len, GISTSTATE *giststate) pfree(DatumGetPointer(((GISTENTRY *) VARDATA(evec))[i].key)); gistcentryinit(giststate, j, ¢ry[j], datum, - (Relation) NULL, (Page) NULL, (OffsetNumber) NULL, + NULL, NULL, (OffsetNumber) 0, datumsize, FALSE, FALSE); isnull[j] = ' '; attr[j] = centry[j].key; @@ -793,10 +793,10 @@ gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *gis ev0p = &((GISTENTRY *) VARDATA(evec))[0]; ev1p = &((GISTENTRY *) VARDATA(evec))[1]; - gistDeCompressAtt(giststate, r, oldtup, (Page) NULL, + gistDeCompressAtt(giststate, r, oldtup, NULL, (OffsetNumber) 0, oldatt, olddec, oldisnull); - gistDeCompressAtt(giststate, r, addtup, (Page) NULL, + gistDeCompressAtt(giststate, r, addtup, NULL, (OffsetNumber) 0, addatt, adddec, addisnull); @@ -841,7 +841,7 @@ gistgetadjusted(Relation r, IndexTuple oldtup, IndexTuple addtup, GISTSTATE *gis pfree(DatumGetPointer(addatt[j].key)); gistcentryinit(giststate, j, ¢ry[j], datum, - (Relation) NULL, (Page) NULL, (OffsetNumber) NULL, + NULL, NULL, (OffsetNumber) 0, datumsize, FALSE, FALSE); isnull[j] = ' '; @@ -929,8 +929,7 @@ gistunionsubkey(Relation r, GISTSTATE *giststate, IndexTuple *itvec, GIST_SPLITV gistdentryinit(giststate, j, &((GISTENTRY *) VARDATA(evec))[reallen], datum, - (Relation) NULL, (Page) NULL, - (OffsetNumber) NULL, + NULL, NULL, (OffsetNumber) 0, ATTSIZE(datum, giststate->tupdesc, j + 1, IsNull), FALSE, IsNull); if ((!isAttByVal(giststate, j)) && ((GISTENTRY *) VARDATA(evec))[reallen].key != datum) @@ -1110,7 +1109,7 @@ gistadjsubkey(Relation r, { if (v->spl_idgrp[i + 1] == 0) /* already inserted */ continue; - gistDeCompressAtt(giststate, r, itup[i], (Page) NULL, (OffsetNumber) 0, + gistDeCompressAtt(giststate, r, itup[i], NULL, (OffsetNumber) 0, identry, decfree, isnull); v->spl_ngrp[v->spl_idgrp[i + 1]]--; @@ -1127,12 +1126,12 @@ gistadjsubkey(Relation r, /* where? */ for (j = 1; j < r->rd_att->natts; j++) { - gistentryinit(entry, v->spl_lattr[j], r, (Page) NULL, + gistentryinit(entry, v->spl_lattr[j], r, NULL, (OffsetNumber) 0, v->spl_lattrsize[j], FALSE); gistpenalty(giststate, j, &entry, v->spl_lisnull[j], &identry[j], isnull[j], &lpenalty); - gistentryinit(entry, v->spl_rattr[j], r, (Page) NULL, + gistentryinit(entry, v->spl_rattr[j], r, NULL, (OffsetNumber) 0, v->spl_rattrsize[j], FALSE); gistpenalty(giststate, j, &entry, v->spl_risnull[j], &identry[j], isnull[j], &rpenalty); @@ -1486,7 +1485,7 @@ gistchoose(Relation r, Page p, IndexTuple it, /* it has compressed entry */ which = -1; sum_grow = 1; gistDeCompressAtt(giststate, r, - it, (Page) NULL, (OffsetNumber) 0, + it, NULL, (OffsetNumber) 0, identry, decompvec, isnull); for (i = FirstOffsetNumber; i <= maxoff && sum_grow; i = OffsetNumberNext(i)) @@ -1530,7 +1529,7 @@ gistfreestack(GISTSTACK *s) { GISTSTACK *p; - while (s != (GISTSTACK *) NULL) + while (s != NULL) { p = s->gs_parent; pfree(s); @@ -1609,7 +1608,7 @@ gistbulkdelete(PG_FUNCTION_ARGS) */ /* walk through the entire index */ - iscan = index_beginscan(NULL, rel, SnapshotAny, 0, (ScanKey) NULL); + iscan = index_beginscan(NULL, rel, SnapshotAny, 0, NULL); /* including killed tuples */ iscan->ignore_killed_tuples = false; @@ -1829,7 +1828,7 @@ gistFormTuple(GISTSTATE *giststate, Relation r, else { gistcentryinit(giststate, j, ¢ry[j], attdata[j], - (Relation) NULL, (Page) NULL, (OffsetNumber) NULL, + NULL, NULL, (OffsetNumber) 0, datumsize[j], FALSE, FALSE); isnullchar[j] = ' '; compatt[j] = centry[j].key; diff --git a/src/backend/access/gist/gistget.c b/src/backend/access/gist/gistget.c index d78f923bd13..faf2f8429b8 100644 --- a/src/backend/access/gist/gistget.c +++ b/src/backend/access/gist/gistget.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.39 2003/11/29 19:51:39 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistget.c,v 1.40 2004/01/07 18:56:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -76,7 +76,7 @@ gistfirst(IndexScanDesc s, ScanDirection dir) while (n < FirstOffsetNumber || n > maxoff) { ReleaseBuffer(b); - if (so->s_stack == (GISTSTACK *) NULL) + if (so->s_stack == NULL) return false; stk = so->s_stack; @@ -158,7 +158,7 @@ gistnext(IndexScanDesc s, ScanDirection dir) while (n < FirstOffsetNumber || n > maxoff) { ReleaseBuffer(b); - if (so->s_stack == (GISTSTACK *) NULL) + if (so->s_stack == NULL) return false; stk = so->s_stack; diff --git a/src/backend/access/gist/gistscan.c b/src/backend/access/gist/gistscan.c index 469c01945ab..30bb9b810af 100644 --- a/src/backend/access/gist/gistscan.c +++ b/src/backend/access/gist/gistscan.c @@ -8,7 +8,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.50 2003/11/29 19:51:39 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/gist/gistscan.c,v 1.51 2004/01/07 18:56:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -47,7 +47,7 @@ typedef struct GISTScanListData typedef GISTScanListData *GISTScanList; /* pointer to list of local scans on GiSTs */ -static GISTScanList GISTScans = (GISTScanList) NULL; +static GISTScanList GISTScans = NULL; Datum gistbeginscan(PG_FUNCTION_ARGS) @@ -79,19 +79,19 @@ gistrescan(PG_FUNCTION_ARGS) ItemPointerSetInvalid(&s->currentMarkData); p = (GISTScanOpaque) s->opaque; - if (p != (GISTScanOpaque) NULL) + if (p != NULL) { /* rescan an existing indexscan --- reset state */ gistfreestack(p->s_stack); gistfreestack(p->s_markstk); - p->s_stack = p->s_markstk = (GISTSTACK *) NULL; + p->s_stack = p->s_markstk = NULL; p->s_flags = 0x0; } else { /* initialize opaque data */ p = (GISTScanOpaque) palloc(sizeof(GISTScanOpaqueData)); - p->s_stack = p->s_markstk = (GISTSTACK *) NULL; + p->s_stack = p->s_markstk = NULL; p->s_flags = 0x0; s->opaque = p; p->giststate = (GISTSTATE *) palloc(sizeof(GISTSTATE)); @@ -137,11 +137,11 @@ gistmarkpos(PG_FUNCTION_ARGS) else p->s_flags &= ~GS_MRKBEFORE; - o = (GISTSTACK *) NULL; + o = NULL; n = p->s_stack; /* copy the parent stack from the current item data */ - while (n != (GISTSTACK *) NULL) + while (n != NULL) { tmp = (GISTSTACK *) palloc(sizeof(GISTSTACK)); tmp->gs_child = n->gs_child; @@ -173,11 +173,11 @@ gistrestrpos(PG_FUNCTION_ARGS) else p->s_flags &= ~GS_CURBEFORE; - o = (GISTSTACK *) NULL; + o = NULL; n = p->s_markstk; /* copy the parent stack from the current item data */ - while (n != (GISTSTACK *) NULL) + while (n != NULL) { tmp = (GISTSTACK *) palloc(sizeof(GISTSTACK)); tmp->gs_child = n->gs_child; @@ -201,7 +201,7 @@ gistendscan(PG_FUNCTION_ARGS) p = (GISTScanOpaque) s->opaque; - if (p != (GISTScanOpaque) NULL) + if (p != NULL) { gistfreestack(p->s_stack); gistfreestack(p->s_markstk); @@ -233,18 +233,16 @@ gistdropscan(IndexScanDesc s) GISTScanList l; GISTScanList prev; - prev = (GISTScanList) NULL; + prev = NULL; - for (l = GISTScans; - l != (GISTScanList) NULL && l->gsl_scan != s; - l = l->gsl_next) + for (l = GISTScans; l != NULL && l->gsl_scan != s; l = l->gsl_next) prev = l; - if (l == (GISTScanList) NULL) + if (l == NULL) elog(ERROR, "GiST scan list corrupted -- could not find 0x%p", (void *) s); - if (prev == (GISTScanList) NULL) + if (prev == NULL) GISTScans = l->gsl_next; else prev->gsl_next = l->gsl_next; @@ -280,7 +278,7 @@ gistadjscans(Relation rel, int op, BlockNumber blkno, OffsetNumber offnum) Oid relid; relid = RelationGetRelid(rel); - for (l = GISTScans; l != (GISTScanList) NULL; l = l->gsl_next) + for (l = GISTScans; l != NULL; l = l->gsl_next) { if (l->gsl_scan->indexRelation->rd_id == relid) gistadjone(l->gsl_scan, op, blkno, offnum); @@ -397,12 +395,10 @@ adjustiptr(IndexScanDesc s, * are looking at already in this transaction, we ignore the update * request. */ -/*ARGSUSED*/ static void -adjuststack(GISTSTACK *stk, - BlockNumber blkno) +adjuststack(GISTSTACK *stk, BlockNumber blkno) { - while (stk != (GISTSTACK *) NULL) + while (stk != NULL) { if (stk->gs_blk == blkno) stk->gs_child = FirstOffsetNumber; diff --git a/src/backend/access/hash/hash.c b/src/backend/access/hash/hash.c index 2623a41f083..5ada6b34d87 100644 --- a/src/backend/access/hash/hash.c +++ b/src/backend/access/hash/hash.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.69 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hash.c,v 1.70 2004/01/07 18:56:23 neilc Exp $ * * NOTES * This file contains only the public interface routines. @@ -180,7 +180,7 @@ hashinsert(PG_FUNCTION_ARGS) if (IndexTupleHasNulls(itup)) { pfree(itup); - PG_RETURN_POINTER((InsertIndexResult) NULL); + PG_RETURN_POINTER(NULL); } hitem = _hash_formitem(itup); diff --git a/src/backend/access/hash/hashscan.c b/src/backend/access/hash/hashscan.c index 656e67c7cdb..fcf2a01cddb 100644 --- a/src/backend/access/hash/hashscan.c +++ b/src/backend/access/hash/hashscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/hash/hashscan.c,v 1.32 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/hash/hashscan.c,v 1.33 2004/01/07 18:56:23 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -26,7 +26,7 @@ typedef struct HashScanListData typedef HashScanListData *HashScanList; -static HashScanList HashScans = (HashScanList) NULL; +static HashScanList HashScans = NULL; /* @@ -73,16 +73,16 @@ _hash_dropscan(IndexScanDesc scan) HashScanList chk, last; - last = (HashScanList) NULL; + last = NULL; for (chk = HashScans; - chk != (HashScanList) NULL && chk->hashsl_scan != scan; + chk != NULL && chk->hashsl_scan != scan; chk = chk->hashsl_next) last = chk; - if (chk == (HashScanList) NULL) + if (chk == NULL) elog(ERROR, "hash scan list trashed; can't find 0x%p", (void *) scan); - if (last == (HashScanList) NULL) + if (last == NULL) HashScans = chk->hashsl_next; else last->hashsl_next = chk->hashsl_next; diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 6f642c7e8e4..a4f9b3afd33 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.160 2004/01/05 20:36:04 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/access/heap/heapam.c,v 1.161 2004/01/07 18:56:24 neilc Exp $ * * * INTERFACE ROUTINES @@ -124,7 +124,7 @@ heapgettup(Relation relation, int linesleft; ItemPointer tid; - tid = (tuple->t_data == NULL) ? (ItemPointer) NULL : &(tuple->t_self); + tid = (tuple->t_data == NULL) ? NULL : &(tuple->t_self); /* * debugging stuff @@ -919,7 +919,7 @@ heap_fetch(Relation relation, * check time qualification of tuple, then release lock */ HeapTupleSatisfies(tuple, relation, buffer, dp, - snapshot, 0, (ScanKey) NULL, valid); + snapshot, 0, NULL, valid); LockBuffer(buffer, BUFFER_LOCK_UNLOCK); @@ -1026,7 +1026,7 @@ heap_get_latest_tid(Relation relation, */ HeapTupleSatisfies(&tp, relation, buffer, dp, - snapshot, 0, (ScanKey) NULL, valid); + snapshot, 0, NULL, valid); linkend = true; if ((t_data->t_infomask & HEAP_XMIN_COMMITTED) != 0 && @@ -1946,7 +1946,7 @@ heap_restrpos(HeapScanDesc scan) &(scan->rs_cbuf), scan->rs_snapshot, 0, - (ScanKey) NULL); + NULL); } } diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index b2300646095..51601efc597 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -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; diff --git a/src/backend/access/nbtree/nbtree.c b/src/backend/access/nbtree/nbtree.c index 8c04f5496bb..b989ee3c23c 100644 --- a/src/backend/access/nbtree/nbtree.c +++ b/src/backend/access/nbtree/nbtree.c @@ -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); diff --git a/src/backend/access/nbtree/nbtsort.c b/src/backend/access/nbtree/nbtsort.c index 583a18f1711..0986f49a6e3 100644 --- a/src/backend/access/nbtree/nbtsort.c +++ b/src/backend/access/nbtree/nbtsort.c @@ -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; diff --git a/src/backend/access/nbtree/nbtutils.c b/src/backend/access/nbtree/nbtutils.c index 888c20e882f..1c401e5e22d 100644 --- a/src/backend/access/nbtree/nbtutils.c +++ b/src/backend/access/nbtree/nbtutils.c @@ -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; diff --git a/src/backend/access/nbtree/nbtxlog.c b/src/backend/access/nbtree/nbtxlog.c index 0a6aaa11470..02dbd33341d 100644 --- a/src/backend/access/nbtree/nbtxlog.c +++ b/src/backend/access/nbtree/nbtxlog.c @@ -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; diff --git a/src/backend/access/rtree/rtget.c b/src/backend/access/rtree/rtget.c index 0f7a046964d..a20ce5bc2fa 100644 --- a/src/backend/access/rtree/rtget.c +++ b/src/backend/access/rtree/rtget.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/rtree/rtget.c,v 1.30 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/rtree/rtget.c,v 1.31 2004/01/07 18:56:24 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -74,7 +74,7 @@ rtfirst(IndexScanDesc s, ScanDirection dir) while (n < FirstOffsetNumber || n > maxoff) { ReleaseBuffer(b); - if (so->s_stack == (RTSTACK *) NULL) + if (so->s_stack == NULL) return false; stk = so->s_stack; @@ -156,7 +156,7 @@ rtnext(IndexScanDesc s, ScanDirection dir) while (n < FirstOffsetNumber || n > maxoff) { ReleaseBuffer(b); - if (so->s_stack == (RTSTACK *) NULL) + if (so->s_stack == NULL) return false; stk = so->s_stack; diff --git a/src/backend/access/rtree/rtproc.c b/src/backend/access/rtree/rtproc.c index 6fe35565af9..97030e2d60b 100644 --- a/src/backend/access/rtree/rtproc.c +++ b/src/backend/access/rtree/rtproc.c @@ -15,7 +15,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/rtree/rtproc.c,v 1.39 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/rtree/rtproc.c,v 1.40 2004/01/07 18:56:24 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -74,7 +74,7 @@ rt_box_size(PG_FUNCTION_ARGS) /* NB: size is an output argument */ float *size = (float *) PG_GETARG_POINTER(1); - if (a == (BOX *) NULL || a->high.x <= a->low.x || a->high.y <= a->low.y) + if (a == NULL || a->high.x <= a->low.x || a->high.y <= a->low.y) *size = 0.0; else *size = (float) ((a->high.x - a->low.x) * (a->high.y - a->low.y)); diff --git a/src/backend/access/rtree/rtree.c b/src/backend/access/rtree/rtree.c index 221fff2092a..9414e314289 100644 --- a/src/backend/access/rtree/rtree.c +++ b/src/backend/access/rtree/rtree.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.81 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/rtree/rtree.c,v 1.82 2004/01/07 18:56:24 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -244,7 +244,7 @@ rtinsert(PG_FUNCTION_ARGS) if (IndexTupleHasNulls(itup)) { pfree(itup); - PG_RETURN_POINTER((InsertIndexResult) NULL); + PG_RETURN_POINTER(NULL); } initRtstate(&rtState, r); @@ -275,7 +275,7 @@ rtdoinsert(Relation r, IndexTuple itup, RTSTATE *rtstate) blk = P_ROOT; buffer = InvalidBuffer; - stack = (RTSTACK *) NULL; + stack = NULL; do { @@ -360,7 +360,7 @@ rttighten(Relation r, newd_size; Buffer b; - if (stk == (RTSTACK *) NULL) + if (stk == NULL) return; b = ReadBuffer(r, stk->rts_blk); @@ -622,7 +622,7 @@ rtintinsert(Relation r, newdatum; InsertIndexResult res; - if (stk == (RTSTACK *) NULL) + if (stk == NULL) { rtnewroot(r, ltup, rtup); return; @@ -912,7 +912,7 @@ rtpicksplit(Relation r, */ /* to keep compiler quiet */ - cost_vector = (SPLITCOST *) NULL; + cost_vector = NULL; if (num_tuples_without_seeds > 0) { @@ -1172,7 +1172,7 @@ freestack(RTSTACK *s) { RTSTACK *p; - while (s != (RTSTACK *) NULL) + while (s != NULL) { p = s->rts_parent; pfree(s); @@ -1213,7 +1213,7 @@ rtbulkdelete(PG_FUNCTION_ARGS) */ /* walk through the entire index */ - iscan = index_beginscan(NULL, rel, SnapshotAny, 0, (ScanKey) NULL); + iscan = index_beginscan(NULL, rel, SnapshotAny, 0, NULL); /* including killed tuples */ iscan->ignore_killed_tuples = false; diff --git a/src/backend/access/rtree/rtscan.c b/src/backend/access/rtree/rtscan.c index b5ceeb8b0e1..9dac2a15c06 100644 --- a/src/backend/access/rtree/rtscan.c +++ b/src/backend/access/rtree/rtscan.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/rtree/rtscan.c,v 1.50 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/rtree/rtscan.c,v 1.51 2004/01/07 18:56:24 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -48,7 +48,7 @@ typedef struct RTScanListData typedef RTScanListData *RTScanList; /* pointer to list of local scans on rtrees */ -static RTScanList RTScans = (RTScanList) NULL; +static RTScanList RTScans = NULL; Datum rtbeginscan(PG_FUNCTION_ARGS) @@ -80,19 +80,19 @@ rtrescan(PG_FUNCTION_ARGS) ItemPointerSetInvalid(&s->currentMarkData); p = (RTreeScanOpaque) s->opaque; - if (p != (RTreeScanOpaque) NULL) + if (p != NULL) { /* rescan an existing indexscan --- reset state */ freestack(p->s_stack); freestack(p->s_markstk); - p->s_stack = p->s_markstk = (RTSTACK *) NULL; + p->s_stack = p->s_markstk = NULL; p->s_flags = 0x0; } else { /* initialize opaque data */ p = (RTreeScanOpaque) palloc(sizeof(RTreeScanOpaqueData)); - p->s_stack = p->s_markstk = (RTSTACK *) NULL; + p->s_stack = p->s_markstk = NULL; p->s_internalNKey = s->numberOfKeys; p->s_flags = 0x0; s->opaque = p; @@ -156,11 +156,11 @@ rtmarkpos(PG_FUNCTION_ARGS) else p->s_flags &= ~RTS_MRKBEFORE; - o = (RTSTACK *) NULL; + o = NULL; n = p->s_stack; /* copy the parent stack from the current item data */ - while (n != (RTSTACK *) NULL) + while (n != NULL) { tmp = (RTSTACK *) palloc(sizeof(RTSTACK)); tmp->rts_child = n->rts_child; @@ -192,11 +192,11 @@ rtrestrpos(PG_FUNCTION_ARGS) else p->s_flags &= ~RTS_CURBEFORE; - o = (RTSTACK *) NULL; + o = NULL; n = p->s_markstk; /* copy the parent stack from the current item data */ - while (n != (RTSTACK *) NULL) + while (n != NULL) { tmp = (RTSTACK *) palloc(sizeof(RTSTACK)); tmp->rts_child = n->rts_child; @@ -220,7 +220,7 @@ rtendscan(PG_FUNCTION_ARGS) p = (RTreeScanOpaque) s->opaque; - if (p != (RTreeScanOpaque) NULL) + if (p != NULL) { freestack(p->s_stack); freestack(p->s_markstk); @@ -250,18 +250,18 @@ rtdropscan(IndexScanDesc s) RTScanList l; RTScanList prev; - prev = (RTScanList) NULL; + prev = NULL; for (l = RTScans; - l != (RTScanList) NULL && l->rtsl_scan != s; + l != NULL && l->rtsl_scan != s; l = l->rtsl_next) prev = l; - if (l == (RTScanList) NULL) + if (l == NULL) elog(ERROR, "rtree scan list corrupted -- could not find 0x%p", (void *) s); - if (prev == (RTScanList) NULL) + if (prev == NULL) RTScans = l->rtsl_next; else prev->rtsl_next = l->rtsl_next; @@ -297,7 +297,7 @@ rtadjscans(Relation r, int op, BlockNumber blkno, OffsetNumber offnum) Oid relid; relid = RelationGetRelid(r); - for (l = RTScans; l != (RTScanList) NULL; l = l->rtsl_next) + for (l = RTScans; l != NULL; l = l->rtsl_next) { if (RelationGetRelid(l->rtsl_scan->indexRelation) == relid) rtadjone(l->rtsl_scan, op, blkno, offnum); @@ -414,12 +414,10 @@ adjustiptr(IndexScanDesc s, * are looking at already in this transaction, we ignore the update * request. */ -/*ARGSUSED*/ static void -adjuststack(RTSTACK *stk, - BlockNumber blkno) +adjuststack(RTSTACK *stk, BlockNumber blkno) { - while (stk != (RTSTACK *) NULL) + while (stk != NULL) { if (stk->rts_blk == blkno) stk->rts_child = FirstOffsetNumber; diff --git a/src/backend/access/transam/varsup.c b/src/backend/access/transam/varsup.c index 2cd6a7dba1f..d09a9d504d6 100644 --- a/src/backend/access/transam/varsup.c +++ b/src/backend/access/transam/varsup.c @@ -6,7 +6,7 @@ * Copyright (c) 2000-2003, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.53 2003/11/29 19:51:40 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/varsup.c,v 1.54 2004/01/07 18:56:24 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -77,7 +77,7 @@ GetNewTransactionId(void) * (SInvalLock would then mean primarily that PROCs couldn't be added/ * removed while holding the lock.) */ - if (MyProc != (PGPROC *) NULL) + if (MyProc != NULL) MyProc->xid = xid; LWLockRelease(XidGenLock); diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 93375b2960e..c7725b0f621 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.158 2003/12/02 19:26:47 joe Exp $ + * $PostgreSQL: pgsql/src/backend/access/transam/xact.c,v 1.159 2004/01/07 18:56:24 neilc Exp $ * * NOTES * Transaction aborts can now occur two ways: @@ -947,7 +947,7 @@ CommitTransaction(void) * as running as well or it will see two tuple versions - one deleted * by xid 1 and one inserted by xid 0. See notes in GetSnapshotData. */ - if (MyProc != (PGPROC *) NULL) + if (MyProc != NULL) { /* Lock SInvalLock because that's what GetSnapshotData uses. */ LWLockAcquire(SInvalLock, LW_EXCLUSIVE); @@ -1064,7 +1064,7 @@ AbortTransaction(void) * this must be done _before_ releasing locks we hold and _after_ * RecordTransactionAbort. */ - if (MyProc != (PGPROC *) NULL) + if (MyProc != NULL) { /* Lock SInvalLock because that's what GetSnapshotData uses. */ LWLockAcquire(SInvalLock, LW_EXCLUSIVE); @@ -1831,7 +1831,7 @@ xact_desc(char *buf, uint8 xl_info, char *rec) } void - XactPushRollback(void (*func) (void *), void *data) +XactPushRollback(void (*func) (void *), void *data) { #ifdef XLOG_II if (_RollbackFunc != NULL) |