remove redundant initializations
authorBruce Momjian
Fri, 4 Sep 2020 02:57:35 +0000 (22:57 -0400)
committerBruce Momjian
Fri, 4 Sep 2020 02:57:35 +0000 (22:57 -0400)
Reported-by: Ranier Vilela
Discussion: https://postgr.es/m/CAEudQAo1+AcGppxDSg8k+zF4+Kv+eJyqzEDdbpDg58-=MQcerQ@mail.gmail.com

Author: Ranier Vilela

Backpatch-through: master

src/backend/access/gist/gistxlog.c
src/backend/catalog/heap.c
src/backend/storage/smgr/md.c
src/backend/utils/adt/json.c
src/backend/utils/mmgr/mcxt.c

index dcd28f678b3db168c5070d3d7d67f26c8a89f1c7..91b3e111820d2a3194e78b4a41078b1a31ddc5fe 100644 (file)
@@ -405,7 +405,6 @@ gistRedoPageReuse(XLogReaderState *record)
         * logged value is very old, so that XID wrap-around already happened
         * on it, there can't be any snapshots that still see it.
         */
-       nextXid = ReadNextFullTransactionId();
        diff = U64FromFullTransactionId(nextXid) -
            U64FromFullTransactionId(latestRemovedFullXid);
        if (diff < MaxTransactionId / 2)
index abd5bdb866b3aaacf62ec1c3c49684cc818cd8b5..c151ad829d49e18e23fdb720a4db8aa82bfd7aea 100644 (file)
@@ -3436,7 +3436,7 @@ List *
 heap_truncate_find_FKs(List *relationIds)
 {
    List       *result = NIL;
-   List       *oids = list_copy(relationIds);
+   List       *oids;
    List       *parent_cons;
    ListCell   *cell;
    ScanKeyData key;
index 0eacd461cd382d57ae437f73bd77fb352e129ff1..1d4aa482ccdd04e1c287e7bc46b30ead47c71e4a 100644 (file)
@@ -734,9 +734,11 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, BlockNumber blocknum,
 BlockNumber
 mdnblocks(SMgrRelation reln, ForkNumber forknum)
 {
-   MdfdVec    *v = mdopenfork(reln, forknum, EXTENSION_FAIL);
+   MdfdVec    *v;
    BlockNumber nblocks;
-   BlockNumber segno = 0;
+   BlockNumber segno;
+
+   mdopenfork(reln, forknum, EXTENSION_FAIL);
 
    /* mdopen has opened the first segment */
    Assert(reln->md_num_open_segs[forknum] > 0);
index a7a91b72f69b2f35b153c8408d5c6f55c2590320..420d3cdcbb9d790f00b02c25897e4efdcc07840d 100644 (file)
@@ -990,7 +990,7 @@ catenate_stringinfo_string(StringInfo buffer, const char *addon)
 Datum
 json_build_object(PG_FUNCTION_ARGS)
 {
-   int         nargs = PG_NARGS();
+   int         nargs;
    int         i;
    const char *sep = "";
    StringInfo  result;
index 88c76f290cea81cdc1a58cc95acce617c518f54e..dda70ef9f33443074d98e1927ea3dea3160bf117 100644 (file)
@@ -476,7 +476,7 @@ MemoryContextMemAllocated(MemoryContext context, bool recurse)
 
    if (recurse)
    {
-       MemoryContext child = context->firstchild;
+       MemoryContext child;
 
        for (child = context->firstchild;
             child != NULL;