A few trivial code cleanups motivated by reading warnings generated
authorTom Lane <tgl@sss.pgh.pa.us>
Tue, 18 Oct 2005 01:06:24 +0000 (01:06 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Tue, 18 Oct 2005 01:06:24 +0000 (01:06 +0000)
by a recent HP C compiler.  Mostly, get rid of useless local variables
that are assigned to but never used.

src/backend/access/gist/gist.c
src/backend/access/hash/hashinsert.c
src/backend/access/hash/hashsearch.c
src/backend/access/nbtree/nbtsearch.c
src/backend/access/nbtree/nbtutils.c
src/backend/access/nbtree/nbtxlog.c
src/backend/catalog/heap.c
src/backend/catalog/pg_conversion.c
src/backend/commands/typecmds.c
src/backend/executor/nodeHashjoin.c
src/backend/rewrite/rewriteDefine.c

index ea45c00cf85641736a7022062f8630848efa6d72..49d0cf11b71cd24cba1017d324a0f55ae126ab1a 100644 (file)
@@ -321,14 +321,12 @@ gistplacetopage(GISTInsertState *state, GISTSTATE *giststate)
                /* no space for insertion */
                IndexTuple *itvec,
                                   *newitup;
-               int                     tlen,
-                                       olen;
+               int                     tlen;
                SplitedPageLayout *dist = NULL,
                                   *ptr;
 
                is_splitted = true;
                itvec = gistextractbuffer(state->stack->buffer, &tlen);
-               olen = tlen;
                itvec = gistjoinvector(itvec, &tlen, state->itup, state->ituplen);
                newitup = gistSplit(state->r, state->stack->buffer, itvec, &tlen, &dist, giststate);
 
index ddc1851751fd3b8a34207c2369662625c808ee7e..9bc2bd13941ecc857803b05d4c45725978debce6 100644 (file)
@@ -37,8 +37,6 @@ _hash_doinsert(Relation rel, HashItem hitem)
        Buffer          metabuf;
        HashMetaPage metap;
        IndexTuple      itup;
-       BlockNumber itup_blkno;
-       OffsetNumber itup_off;
        BlockNumber blkno;
        Page            page;
        HashPageOpaque pageopaque;
@@ -159,8 +157,7 @@ _hash_doinsert(Relation rel, HashItem hitem)
        }
 
        /* found page with enough space, so add the item here */
-       itup_off = _hash_pgaddtup(rel, buf, itemsz, hitem);
-       itup_blkno = BufferGetBlockNumber(buf);
+       (void) _hash_pgaddtup(rel, buf, itemsz, hitem);
 
        /* write and release the modified page */
        _hash_wrtbuf(rel, buf);
index 77d16a7bf0e672b266965fd2e922478e29cbdbf9..3d2d71a193f23b0b8466a55a0a797df5a8c5e6b8 100644 (file)
@@ -247,7 +247,6 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
        HashPageOpaque opaque;
        OffsetNumber maxoff;
        OffsetNumber offnum;
-       Bucket          bucket;
        BlockNumber blkno;
        HashItem        hitem;
        IndexTuple      itup;
@@ -258,7 +257,6 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
        page = BufferGetPage(buf);
        _hash_checkpage(rel, page, LH_BUCKET_PAGE | LH_OVERFLOW_PAGE);
        opaque = (HashPageOpaque) PageGetSpecialPointer(page);
-       bucket = opaque->hasho_bucket;
 
        /*
         * If _hash_step is called from _hash_first, current will not be valid, so
@@ -274,8 +272,8 @@ _hash_step(IndexScanDesc scan, Buffer *bufP, ScanDirection dir)
        /*
         * 'offnum' now points to the last tuple we have seen (if any).
         *
-        * continue to step through tuples until: 1) we get to the end of the bucket
-        * chain or 2) we find a valid tuple.
+        * continue to step through tuples until: 1) we get to the end of the
+        * bucket chain or 2) we find a valid tuple.
         */
        do
        {
index a6c92a0c309a40bb29107a6d56bdb0c6aef11012..6c575fe4a3be1e9e2b9d4418a71cdb5b6553dc66 100644 (file)
@@ -225,7 +225,6 @@ _bt_binsrch(Relation rel,
                        ScanKey scankey,
                        bool nextkey)
 {
-       TupleDesc       itupdesc;
        Page            page;
        BTPageOpaque opaque;
        OffsetNumber low,
@@ -233,7 +232,6 @@ _bt_binsrch(Relation rel,
        int32           result,
                                cmpval;
 
-       itupdesc = RelationGetDescr(rel);
        page = BufferGetPage(buf);
        opaque = (BTPageOpaque) PageGetSpecialPointer(page);
 
index 90606a8a9843388679fba2e9a5d9010a4866d24e..138d554d387cef240d88897a18b83d55a7bdb284 100644 (file)
@@ -79,11 +79,9 @@ ScanKey
 _bt_mkscankey_nodata(Relation rel)
 {
        ScanKey         skey;
-       TupleDesc       itupdesc;
        int                     natts;
        int                     i;
 
-       itupdesc = RelationGetDescr(rel);
        natts = RelationGetNumberOfAttributes(rel);
 
        skey = (ScanKey) palloc(natts * sizeof(ScanKeyData));
index a6c7933363c17ba98cb7aa1ec7814f128b3c2898..0d5e94ede0222c54c7440afbe71ae015044127a9 100644 (file)
@@ -156,7 +156,6 @@ btree_xlog_insert(bool isleaf, bool ismeta,
        Relation        reln;
        Buffer          buffer;
        Page            page;
-       BTPageOpaque pageop;
        char       *datapos;
        int                     datalen;
        xl_btree_metadata md;
@@ -187,7 +186,6 @@ btree_xlog_insert(bool isleaf, bool ismeta,
                page = (Page) BufferGetPage(buffer);
                if (PageIsNew((PageHeader) page))
                        elog(PANIC, "btree_insert_redo: uninitialized page");
-               pageop = (BTPageOpaque) PageGetSpecialPointer(page);
 
                if (XLByteLE(lsn, PageGetLSN(page)))
                {
index 405aa482f2eecc37a3d5a7a3b98aeb594ae68494..d87b77988cd9afd8babd6ad259cda6a751d245e9 100644 (file)
@@ -1452,7 +1452,6 @@ AddRelationRawConstraints(Relation rel,
        TupleDesc       tupleDesc;
        TupleConstr *oldconstr;
        int                     numoldchecks;
-       ConstrCheck *oldchecks;
        ParseState *pstate;
        RangeTblEntry *rte;
        int                     numchecks;
@@ -1467,15 +1466,9 @@ AddRelationRawConstraints(Relation rel,
        tupleDesc = RelationGetDescr(rel);
        oldconstr = tupleDesc->constr;
        if (oldconstr)
-       {
                numoldchecks = oldconstr->num_check;
-               oldchecks = oldconstr->check;
-       }
        else
-       {
                numoldchecks = 0;
-               oldchecks = NULL;
-       }
 
        /*
         * Create a dummy ParseState and insert the target relation as its sole
index de21eb5dc129732d5074803dd93d44b80d143cca..3941748e681997d6cfcb157866349714378e417f 100644 (file)
@@ -174,7 +174,6 @@ void
 RemoveConversionById(Oid conversionOid)
 {
        Relation        rel;
-       TupleDesc       tupDesc;
        HeapTuple       tuple;
        HeapScanDesc scan;
        ScanKeyData scanKeyData;
@@ -186,7 +185,6 @@ RemoveConversionById(Oid conversionOid)
 
        /* open pg_conversion */
        rel = heap_open(ConversionRelationId, RowExclusiveLock);
-       tupDesc = rel->rd_att;
 
        scan = heap_beginscan(rel, SnapshotNow,
                                                  1, &scanKeyData);
index 04ae679c27f3e12b01ab56fadb66ae2631dcff8a..dc43babaadf8e2ece78a1fbad64dbf00a8cadb20 100644 (file)
@@ -1335,7 +1335,6 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha
        Oid                     domainoid;
        HeapTuple       tup;
        Relation        rel;
-       Form_pg_type typTup;
        Relation        conrel;
        SysScanDesc conscan;
        ScanKeyData key[1];
@@ -1379,8 +1378,6 @@ AlterDomainDropConstraint(List *names, const char *constrName, DropBehavior beha
        conscan = systable_beginscan(conrel, ConstraintTypidIndexId, true,
                                                                 SnapshotNow, 1, key);
 
-       typTup = (Form_pg_type) GETSTRUCT(tup);
-
        /*
         * Scan over the result set, removing any matching entries.
         */
index 94b5856e4173fb9ab42c660f42965e6957df7602..64cedb62397967ad99a857a1075a8ecce54aaaf8 100644 (file)
@@ -50,7 +50,6 @@ ExecHashJoin(HashJoinState *node)
        HashState  *hashNode;
        List       *joinqual;
        List       *otherqual;
-       ScanDirection dir;
        TupleTableSlot *inntuple;
        ExprContext *econtext;
        ExprDoneCond isDone;
@@ -68,7 +67,6 @@ ExecHashJoin(HashJoinState *node)
        otherqual = node->js.ps.qual;
        hashNode = (HashState *) innerPlanState(node);
        outerNode = outerPlanState(node);
-       dir = estate->es_direction;
 
        /*
         * get information from HashJoin state
index a29c6e1c63bb4826678261964a80f633020f5139..6772b544aac45a3d266712f7435eb501be6ef9af 100644 (file)
@@ -191,7 +191,6 @@ DefineQueryRewrite(RuleStmt *stmt)
        Oid                     ev_relid;
        Oid                     ruleId;
        int                     event_attno;
-       Oid                     event_attype;
        ListCell   *l;
        Query      *query;
        AclResult       aclresult;
@@ -432,7 +431,6 @@ DefineQueryRewrite(RuleStmt *stmt)
         * This rule is allowed - prepare to install it.
         */
        event_attno = -1;
-       event_attype = InvalidOid;
 
        /*
         * We want the rule's table references to be checked as though by the rule