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/commands | |
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/commands')
-rw-r--r-- | src/backend/commands/async.c | 8 | ||||
-rw-r--r-- | src/backend/commands/dbcommands.c | 4 | ||||
-rw-r--r-- | src/backend/commands/prepare.c | 4 | ||||
-rw-r--r-- | src/backend/commands/sequence.c | 18 | ||||
-rw-r--r-- | src/backend/commands/user.c | 6 | ||||
-rw-r--r-- | src/backend/commands/vacuum.c | 12 |
6 files changed, 26 insertions, 26 deletions
diff --git a/src/backend/commands/async.c b/src/backend/commands/async.c index 3063815533d..bd90961315c 100644 --- a/src/backend/commands/async.c +++ b/src/backend/commands/async.c @@ -7,7 +7,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.106 2003/12/12 18:45:08 petere Exp $ + * $PostgreSQL: pgsql/src/backend/commands/async.c,v 1.107 2004/01/07 18:56:25 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -199,7 +199,7 @@ Async_Listen(char *relname, int pid) lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); /* Detect whether we are already listening on this relname */ - scan = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); + scan = heap_beginscan(lRel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(tuple); @@ -292,7 +292,7 @@ Async_Unlisten(char *relname, int pid) lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); - scan = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); + scan = heap_beginscan(lRel, SnapshotNow, 0, NULL); while ((tuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { Form_pg_listener listener = (Form_pg_listener) GETSTRUCT(tuple); @@ -459,7 +459,7 @@ AtCommit_Notify(void) lRel = heap_openr(ListenerRelationName, AccessExclusiveLock); tdesc = RelationGetDescr(lRel); - scan = heap_beginscan(lRel, SnapshotNow, 0, (ScanKey) NULL); + scan = heap_beginscan(lRel, SnapshotNow, 0, NULL); while ((lTuple = heap_getnext(scan, ForwardScanDirection)) != NULL) { diff --git a/src/backend/commands/dbcommands.c b/src/backend/commands/dbcommands.c index 91cccd5cacd..2b8fdb9a2d4 100644 --- a/src/backend/commands/dbcommands.c +++ b/src/backend/commands/dbcommands.c @@ -9,7 +9,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.129 2003/12/15 22:56:44 momjian Exp $ + * $PostgreSQL: pgsql/src/backend/commands/dbcommands.c,v 1.130 2004/01/07 18:56:25 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -749,7 +749,7 @@ AlterDatabaseSet(AlterDatabaseSetStmt *stmt) datum = heap_getattr(tuple, Anum_pg_database_datconfig, RelationGetDescr(rel), &isnull); - a = isnull ? ((ArrayType *) NULL) : DatumGetArrayTypeP(datum); + a = isnull ? NULL : DatumGetArrayTypeP(datum); if (valuestr) a = GUCArrayAdd(a, stmt->variable, valuestr); diff --git a/src/backend/commands/prepare.c b/src/backend/commands/prepare.c index c2fa6dc9110..0f95f3bfc05 100644 --- a/src/backend/commands/prepare.c +++ b/src/backend/commands/prepare.c @@ -10,7 +10,7 @@ * Copyright (c) 2002-2003, PostgreSQL Global Development Group * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.24 2003/11/29 19:51:47 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/commands/prepare.c,v 1.25 2004/01/07 18:56:25 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -323,7 +323,7 @@ StorePreparedStatement(const char *stmt_name, * out-of-memory failure only wastes memory and doesn't leave us with * an incomplete (ie corrupt) hashtable entry. */ - qstring = query_string ? pstrdup(query_string) : (char *) NULL; + qstring = query_string ? pstrdup(query_string) : NULL; query_list = (List *) copyObject(query_list); plan_list = (List *) copyObject(plan_list); argtype_list = listCopy(argtype_list); diff --git a/src/backend/commands/sequence.c b/src/backend/commands/sequence.c index 54acb5b89cd..3fcc76a72bc 100644 --- a/src/backend/commands/sequence.c +++ b/src/backend/commands/sequence.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.106 2003/12/14 00:34:47 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/sequence.c,v 1.107 2004/01/07 18:56:25 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -946,7 +946,7 @@ init_params(List *options, Form_pg_sequence new, bool isInit) } /* INCREMENT BY */ - if (increment_by != (DefElem *) NULL) + if (increment_by != NULL) { new->increment_by = defGetInt64(increment_by); if (new->increment_by == 0) @@ -958,7 +958,7 @@ init_params(List *options, Form_pg_sequence new, bool isInit) new->increment_by = 1; /* CYCLE */ - if (is_cycled != (DefElem *) NULL) + if (is_cycled != NULL) { new->is_cycled = intVal(is_cycled->arg); Assert(new->is_cycled == false || new->is_cycled == true); @@ -967,11 +967,11 @@ init_params(List *options, Form_pg_sequence new, bool isInit) new->is_cycled = false; /* MAXVALUE (null arg means NO MAXVALUE) */ - if (max_value != (DefElem *) NULL && max_value->arg) + if (max_value != NULL && max_value->arg) { new->max_value = defGetInt64(max_value); } - else if (isInit || max_value != (DefElem *) NULL) + else if (isInit || max_value != NULL) { if (new->increment_by > 0) new->max_value = SEQ_MAXVALUE; /* ascending seq */ @@ -980,11 +980,11 @@ init_params(List *options, Form_pg_sequence new, bool isInit) } /* MINVALUE (null arg means NO MINVALUE) */ - if (min_value != (DefElem *) NULL && min_value->arg) + if (min_value != NULL && min_value->arg) { new->min_value = defGetInt64(min_value); } - else if (isInit || min_value != (DefElem *) NULL) + else if (isInit || min_value != NULL) { if (new->increment_by > 0) new->min_value = 1; /* ascending seq */ @@ -1007,7 +1007,7 @@ init_params(List *options, Form_pg_sequence new, bool isInit) } /* START WITH */ - if (last_value != (DefElem *) NULL) + if (last_value != NULL) new->last_value = defGetInt64(last_value); else if (isInit) { @@ -1044,7 +1044,7 @@ init_params(List *options, Form_pg_sequence new, bool isInit) } /* CACHE */ - if (cache_value != (DefElem *) NULL) + if (cache_value != NULL) { new->cache_value = defGetInt64(cache_value); if (new->cache_value <= 0) diff --git a/src/backend/commands/user.c b/src/backend/commands/user.c index 20be53fbd50..bd8c6b91b9e 100644 --- a/src/backend/commands/user.c +++ b/src/backend/commands/user.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.131 2003/11/29 19:51:47 pgsql Exp $ + * $PostgreSQL: pgsql/src/backend/commands/user.c,v 1.132 2004/01/07 18:56:25 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -986,7 +986,7 @@ AlterUserSet(AlterUserSetStmt *stmt) datum = SysCacheGetAttr(SHADOWNAME, oldtuple, Anum_pg_shadow_useconfig, &isnull); - array = isnull ? ((ArrayType *) NULL) : DatumGetArrayTypeP(datum); + array = isnull ? NULL : DatumGetArrayTypeP(datum); if (valuestr) array = GUCArrayAdd(array, stmt->variable, valuestr); @@ -1457,7 +1457,7 @@ AlterGroup(AlterGroupStmt *stmt, const char *tag) /* Fetch old group membership. */ datum = heap_getattr(group_tuple, Anum_pg_group_grolist, pg_group_dsc, &null); - oldarray = null ? ((IdList *) NULL) : DatumGetIdListP(datum); + oldarray = null ? NULL : DatumGetIdListP(datum); /* initialize list with old array contents */ newlist = IdArrayToList(oldarray); diff --git a/src/backend/commands/vacuum.c b/src/backend/commands/vacuum.c index 71844ff9b93..dae8c3f37cd 100644 --- a/src/backend/commands/vacuum.c +++ b/src/backend/commands/vacuum.c @@ -13,7 +13,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.270 2004/01/06 18:07:31 neilc Exp $ + * $PostgreSQL: pgsql/src/backend/commands/vacuum.c,v 1.271 2004/01/07 18:56:25 neilc Exp $ * *------------------------------------------------------------------------- */ @@ -958,7 +958,7 @@ full_vacuum_rel(Relation onerel, VacuumStmt *vacstmt) vacrelstats->hasindex = true; /* Clean/scan index relation(s) */ - if (Irel != (Relation *) NULL) + if (Irel != NULL) { if (vacuum_pages.num_pages > 0) { @@ -1257,7 +1257,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, * removal of dead tuples. But note we are NOT changing * the real page yet... */ - if (tempPage == (Page) NULL) + if (tempPage == NULL) { Size pageSize; @@ -1284,7 +1284,7 @@ scan_heap(VRelStats *vacrelstats, Relation onerel, } } /* scan along page */ - if (tempPage != (Page) NULL) + if (tempPage != NULL) { /* Some tuples are removable; figure free space after removal */ PageRepairFragmentation(tempPage, NULL); @@ -2406,7 +2406,7 @@ repair_frag(VRelStats *vacrelstats, Relation onerel, if (Nvacpagelist.num_pages > 0) { /* vacuum indexes again if needed */ - if (Irel != (Relation *) NULL) + if (Irel != NULL) { VacPage *vpleft, *vpright, @@ -3057,7 +3057,7 @@ vac_open_indexes(Relation relation, int *nindexes, Relation **Irel) void vac_close_indexes(int nindexes, Relation *Irel) { - if (Irel == (Relation *) NULL) + if (Irel == NULL) return; while (nindexes--) |