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
This commit is contained in:
Tom Lane 2020-09-04 14:32:10 -04:00
parent 3eb3d3e782
commit 38a2d70329
8 changed files with 7 additions and 14 deletions

View File

@ -243,7 +243,6 @@ brin_form_tuple(BrinDesc *brdesc, BlockNumber blkno, BrinMemTuple *tuple,
*bitP |= bitmask; *bitP |= bitmask;
} }
bitP = ((bits8 *) (rettuple + SizeOfBrinTuple)) - 1;
} }
if (tuple->bt_placeholder) if (tuple->bt_placeholder)

View File

@ -241,7 +241,6 @@ ginFindParents(GinBtree btree, GinBtreeStack *stack)
blkno = root->blkno; blkno = root->blkno;
buffer = root->buffer; buffer = root->buffer;
offset = InvalidOffsetNumber;
ptr = (GinBtreeStack *) palloc(sizeof(GinBtreeStack)); ptr = (GinBtreeStack *) palloc(sizeof(GinBtreeStack));

View File

@ -478,7 +478,7 @@ changeDependenciesOf(Oid classId, Oid oldObjectId,
while (HeapTupleIsValid((tup = systable_getnext(scan)))) while (HeapTupleIsValid((tup = systable_getnext(scan))))
{ {
Form_pg_depend depform = (Form_pg_depend) GETSTRUCT(tup); Form_pg_depend depform;
/* make a modifiable copy */ /* make a modifiable copy */
tup = heap_copytuple(tup); tup = heap_copytuple(tup);
@ -561,12 +561,12 @@ changeDependenciesOn(Oid refClassId, Oid oldRefObjectId,
while (HeapTupleIsValid((tup = systable_getnext(scan)))) while (HeapTupleIsValid((tup = systable_getnext(scan))))
{ {
Form_pg_depend depform = (Form_pg_depend) GETSTRUCT(tup);
if (newIsPinned) if (newIsPinned)
CatalogTupleDelete(depRel, &tup->t_self); CatalogTupleDelete(depRel, &tup->t_self);
else else
{ {
Form_pg_depend depform;
/* make a modifiable copy */ /* make a modifiable copy */
tup = heap_copytuple(tup); tup = heap_copytuple(tup);
depform = (Form_pg_depend) GETSTRUCT(tup); depform = (Form_pg_depend) GETSTRUCT(tup);

View File

@ -5097,7 +5097,7 @@ create_ordered_paths(PlannerInfo *root,
foreach(lc, input_rel->partial_pathlist) foreach(lc, input_rel->partial_pathlist)
{ {
Path *input_path = (Path *) lfirst(lc); Path *input_path = (Path *) lfirst(lc);
Path *sorted_path = input_path; Path *sorted_path;
bool is_sorted; bool is_sorted;
int presorted_keys; int presorted_keys;
double total_groups; double total_groups;

View File

@ -1765,7 +1765,6 @@ generateClonedIndexStmt(RangeVar *heapRel, Relation source_idx,
char *attname; char *attname;
attname = get_attname(indrelid, attnum, false); attname = get_attname(indrelid, attnum, false);
keycoltype = get_atttype(indrelid, attnum);
iparam->name = attname; iparam->name = attname;
iparam->expr = NULL; iparam->expr = NULL;

View File

@ -4259,10 +4259,6 @@ get_qual_for_range(Relation parent, PartitionBoundSpec *spec,
return result; return result;
} }
lower_or_start_datum = list_head(spec->lowerdatums);
upper_or_start_datum = list_head(spec->upperdatums);
num_or_arms = key->partnatts;
/* /*
* If it is the recursive call for default, we skip the get_range_nulltest * If it is the recursive call for default, we skip the get_range_nulltest
* to avoid accumulating the NullTest on the same keys for each partition. * to avoid accumulating the NullTest on the same keys for each partition.

View File

@ -232,7 +232,7 @@ ComputeExtStatisticsRows(Relation onerel,
foreach(lc, lstats) foreach(lc, lstats)
{ {
StatExtEntry *stat = (StatExtEntry *) lfirst(lc); StatExtEntry *stat = (StatExtEntry *) lfirst(lc);
int stattarget = stat->stattarget; int stattarget;
VacAttrStats **stats; VacAttrStats **stats;
int nattrs = bms_num_members(stat->columns); int nattrs = bms_num_members(stat->columns);

View File

@ -2124,7 +2124,6 @@ CheckAffix(const char *word, size_t len, AFFIX *Affix, int flagflags, char *neww
} }
else else
{ {
int err;
pg_wchar *data; pg_wchar *data;
size_t data_len; size_t data_len;
int newword_len; int newword_len;
@ -2134,7 +2133,8 @@ CheckAffix(const char *word, size_t len, AFFIX *Affix, int flagflags, char *neww
data = (pg_wchar *) palloc((newword_len + 1) * sizeof(pg_wchar)); data = (pg_wchar *) palloc((newword_len + 1) * sizeof(pg_wchar));
data_len = pg_mb2wchar_with_len(newword, data, newword_len); data_len = pg_mb2wchar_with_len(newword, data, newword_len);
if (!(err = pg_regexec(&(Affix->reg.regex), data, data_len, 0, NULL, 0, NULL, 0))) if (pg_regexec(&(Affix->reg.regex), data, data_len,
0, NULL, 0, NULL, 0) == REG_OKAY)
{ {
pfree(data); pfree(data);
return newword; return newword;