Skip to content

Commit 38a2d70

Browse files
committed
Remove some more useless assignments.
Found with clang's scan-build tool. It also whines about a lot of other dead stores that we should *not* change IMO, either as a matter of style or future-proofing. But these places seem like clear oversights. Discussion: https://postgr.es/m/CAEudQAo1+AcGppxDSg8k+zF4+Kv+eJyqzEDdbpDg58-=MQcerQ@mail.gmail.com
1 parent 3eb3d3e commit 38a2d70

File tree

8 files changed

+7
-14
lines changed

8 files changed

+7
-14
lines changed

src/backend/access/brin/brin_tuple.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,6 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
243243

244244
*bitP |= bitmask;
245245
}
246-
bitP = ((bits8 *) (rettuple + SizeOfBrinTuple)) - 1;
247246
}
248247

249248
if (tuple->bt_placeholder)

src/backend/access/gin/ginbtree.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,6 @@ ginFindParents(GinBtree btree, GinBtreeStack *stack)
241241

242242
blkno = root->blkno;
243243
buffer = root->buffer;
244-
offset = InvalidOffsetNumber;
245244

246245
ptr = (GinBtreeStack *) palloc(sizeof(GinBtreeStack));
247246

src/backend/catalog/pg_depend.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,7 +478,7 @@ changeDependenciesOf(Oid classId, Oid oldObjectId,
478478

479479
while (HeapTupleIsValid((tup = systable_getnext(scan))))
480480
{
481-
Form_pg_depend depform = (Form_pg_depend) GETSTRUCT(tup);
481+
Form_pg_depend depform;
482482

483483
/* make a modifiable copy */
484484
tup = heap_copytuple(tup);
@@ -561,12 +561,12 @@ changeDependenciesOn(Oid refClassId, Oid oldRefObjectId,
561561

562562
while (HeapTupleIsValid((tup = systable_getnext(scan))))
563563
{
564-
Form_pg_depend depform = (Form_pg_depend) GETSTRUCT(tup);
565-
566564
if (newIsPinned)
567565
CatalogTupleDelete(depRel, &tup->t_self);
568566
else
569567
{
568+
Form_pg_depend depform;
569+
570570
/* make a modifiable copy */
571571
tup = heap_copytuple(tup);
572572
depform = (Form_pg_depend) GETSTRUCT(tup);

src/backend/optimizer/plan/planner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5097,7 +5097,7 @@ create_ordered_paths(PlannerInfo *root,
50975097
foreach(lc, input_rel->partial_pathlist)
50985098
{
50995099
Path *input_path = (Path *) lfirst(lc);
5100-
Path *sorted_path = input_path;
5100+
Path *sorted_path;
51015101
bool is_sorted;
51025102
int presorted_keys;
51035103
double total_groups;

src/backend/parser/parse_utilcmd.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1765,7 +1765,6 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx,
17651765
char *attname;
17661766

17671767
attname = get_attname(indrelid, attnum, false);
1768-
keycoltype = get_atttype(indrelid, attnum);
17691768

17701769
iparam->name = attname;
17711770
iparam->expr = NULL;

src/backend/partitioning/partbounds.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4259,10 +4259,6 @@ get_qual_for_range(Relation parent, PartitionBoundSpec *spec,
42594259
return result;
42604260
}
42614261

4262-
lower_or_start_datum = list_head(spec->lowerdatums);
4263-
upper_or_start_datum = list_head(spec->upperdatums);
4264-
num_or_arms = key->partnatts;
4265-
42664262
/*
42674263
* If it is the recursive call for default, we skip the get_range_nulltest
42684264
* to avoid accumulating the NullTest on the same keys for each partition.

src/backend/statistics/extended_stats.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ ComputeExtStatisticsRows(Relation onerel,
232232
foreach(lc, lstats)
233233
{
234234
StatExtEntry *stat = (StatExtEntry *) lfirst(lc);
235-
int stattarget = stat->stattarget;
235+
int stattarget;
236236
VacAttrStats **stats;
237237
int nattrs = bms_num_members(stat->columns);
238238

src/backend/tsearch/spell.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2124,7 +2124,6 @@ CheckAffix(const char *word, size_t len, AFFIX *Affix, int flagflags, char *neww
21242124
}
21252125
else
21262126
{
2127-
int err;
21282127
pg_wchar *data;
21292128
size_t data_len;
21302129
int newword_len;
@@ -2134,7 +2133,8 @@ CheckAffix(const char *word, size_t len, AFFIX *Affix, int flagflags, char *neww
21342133
data = (pg_wchar *) palloc((newword_len + 1) * sizeof(pg_wchar));
21352134
data_len = pg_mb2wchar_with_len(newword, data, newword_len);
21362135

2137-
if (!(err = pg_regexec(&(Affix->reg.regex), data, data_len, 0, NULL, 0, NULL, 0)))
2136+
if (pg_regexec(&(Affix->reg.regex), data, data_len,
2137+
0, NULL, 0, NULL, 0) == REG_OKAY)
21382138
{
21392139
pfree(data);
21402140
return newword;

0 commit comments

Comments
 (0)