Thread: [BUGS] Useless assignments

[BUGS] Useless assignments

From
Дилян Палаузов
Date:
diff --git a/src/backend/catalog/partition.c 
b/src/backend/catalog/partition.c
--- a/src/backend/catalog/partition.c
+++ b/src/backend/catalog/partition.c
@@ -189,7 +189,6 @@ RelationBuildPartitionDesc(Relation rel)        inhoids =
find_inheritance_children(RelationGetRelid(rel),NoLock);
 
        /* Collect bound spec nodes in a list */
-       i = 0;        partoids = NIL;        foreach(cell, inhoids)        {
@@ -1508,7 +1508,6 @@ get_qual_for_range(PartitionKey key, 
PartitionBoundSpec *spec)
        lower_or_start_datum = list_head(spec->lowerdatums);        upper_or_start_datum =
list_head(spec->upperdatums);
-       num_or_arms = key->partnatts;
        /*         * A range-partitioned table does not currently allow partition 
keys to be
diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
--- a/src/backend/storage/smgr/md.c
+++ b/src/backend/storage/smgr/md.c
@@ -872,7 +872,7 @@ mdwrite(SMgrRelation reln, ForkNumber forknum, 
BlockNumber blocknum, BlockNumber mdnblocks(SMgrRelation reln, ForkNumber forknum) {
-       MdfdVec    *v = mdopen(reln, forknum, EXTENSION_FAIL);
+       MdfdVec    *v; mdopen(reln, forknum, EXTENSION_FAIL);        BlockNumber nblocks;        BlockNumber segno =
0;

diff --git a/src/backend/utils/adt/jsonfuncs.c 
b/src/backend/utils/adt/jsonfuncs.c
--- a/src/backend/utils/adt/jsonfuncs.c
+++ b/src/backend/utils/adt/jsonfuncs.c
@@ -4423,7 +4423,7 @@ IteratorConcat(JsonbIterator **it1, JsonbIterator 
**it2,                                rk2;
        r1 = rk1 = JsonbIteratorNext(it1, &v1, false);
-       r2 = rk2 = JsonbIteratorNext(it2, &v2, false);
+       rk2 = JsonbIteratorNext(it2, &v2, false);
        /*         * Both elements are objects.
diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
--- a/src/fe_utils/print.c
+++ b/src/fe_utils/print.c
@@ -433,7 +433,6 @@ print_unaligned_text(const printTableContent *cont, 
FILE *fout)                                if (need_recordsep)                                {
print_separator(cont->opt->recordSep, fout);
-                                       need_recordsep = false;                                }
       fputs(f->data, fout);                                need_recordsep = true;
 
diff --git a/src/backend/replication/logical/worker.c 
b/src/backend/replication/logical/worker.c
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -1202,7 +1202,6 @@ LogicalRepApplyLoop(XLogRecPtr last_received)                                        if (now >=
timeout)                                       {                                                requestReply = true;
 
-                                               ping_sent = true;                                        }
                 }                        }
 


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

Re: [BUGS] Useless assignments

From
Andres Freund
Date:
Hi,

What's the gain of these changes?  Afaics they're largely minor future
proofing and similar.

- Andres

On 2017-06-05 20:21:39 +0200, Дилян Палаузов wrote:
> diff --git a/src/backend/catalog/partition.c
> b/src/backend/catalog/partition.c
> --- a/src/backend/catalog/partition.c
> +++ b/src/backend/catalog/partition.c
> @@ -189,7 +189,6 @@ RelationBuildPartitionDesc(Relation rel)
>         inhoids = find_inheritance_children(RelationGetRelid(rel), NoLock);
> 
>         /* Collect bound spec nodes in a list */
> -       i = 0;
>         partoids = NIL;
>         foreach(cell, inhoids)
>         {
> @@ -1508,7 +1508,6 @@ get_qual_for_range(PartitionKey key,
> PartitionBoundSpec *spec)
> 
>         lower_or_start_datum = list_head(spec->lowerdatums);
>         upper_or_start_datum = list_head(spec->upperdatums);
> -       num_or_arms = key->partnatts;
> 
>         /*
>          * A range-partitioned table does not currently allow partition keys
> to be
> diff --git a/src/backend/storage/smgr/md.c b/src/backend/storage/smgr/md.c
> --- a/src/backend/storage/smgr/md.c
> +++ b/src/backend/storage/smgr/md.c
> @@ -872,7 +872,7 @@ mdwrite(SMgrRelation reln, ForkNumber forknum,
> BlockNumber blocknum,
>  BlockNumber
>  mdnblocks(SMgrRelation reln, ForkNumber forknum)
>  {
> -       MdfdVec    *v = mdopen(reln, forknum, EXTENSION_FAIL);
> +       MdfdVec    *v; mdopen(reln, forknum, EXTENSION_FAIL);
>         BlockNumber nblocks;
>         BlockNumber segno = 0;
> 
> diff --git a/src/backend/utils/adt/jsonfuncs.c
> b/src/backend/utils/adt/jsonfuncs.c
> --- a/src/backend/utils/adt/jsonfuncs.c
> +++ b/src/backend/utils/adt/jsonfuncs.c
> @@ -4423,7 +4423,7 @@ IteratorConcat(JsonbIterator **it1, JsonbIterator
> **it2,
>                                 rk2;
> 
>         r1 = rk1 = JsonbIteratorNext(it1, &v1, false);
> -       r2 = rk2 = JsonbIteratorNext(it2, &v2, false);
> +       rk2 = JsonbIteratorNext(it2, &v2, false);
> 
>         /*
>          * Both elements are objects.
> diff --git a/src/fe_utils/print.c b/src/fe_utils/print.c
> --- a/src/fe_utils/print.c
> +++ b/src/fe_utils/print.c
> @@ -433,7 +433,6 @@ print_unaligned_text(const printTableContent *cont, FILE
> *fout)
>                                 if (need_recordsep)
>                                 {
> 
> print_separator(cont->opt->recordSep, fout);
> -                                       need_recordsep = false;
>                                 }
>                                 fputs(f->data, fout);
>                                 need_recordsep = true;
> diff --git a/src/backend/replication/logical/worker.c
> b/src/backend/replication/logical/worker.c
> --- a/src/backend/replication/logical/worker.c
> +++ b/src/backend/replication/logical/worker.c
> @@ -1202,7 +1202,6 @@ LogicalRepApplyLoop(XLogRecPtr last_received)
>                                         if (now >= timeout)
>                                         {
>                                                 requestReply = true;
> -                                               ping_sent = true;
>                                         }
>                                 }
>                         }
> 
> 
> -- 
> Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-bugs


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs