Merge pull request #21 from citusdata/warn_shadows

Remove shadowed variable definitions
merge-cstore-pykello
Hadi Moshayedi 2020-10-08 13:17:30 -07:00 committed by GitHub
commit ad78260c3d
3 changed files with 7 additions and 12 deletions

View File

@ -25,7 +25,7 @@ else
$(error version $(VER) is not supported) $(error version $(VER) is not supported)
endif endif
PG_CPPFLAGS = -std=c11 PG_CFLAGS = -std=c11 -Wshadow
OBJS = cstore.o cstore_writer.o cstore_reader.o \ OBJS = cstore.o cstore_writer.o cstore_reader.o \
cstore_compression.o mod.o cstore_metadata_tables.o cstore_compression.o mod.o cstore_metadata_tables.o

View File

@ -179,7 +179,6 @@ CStoreReadNextRow(TableReadState *readState, Datum *columnValues, bool *columnNu
uint32 lastBlockIndex = 0; uint32 lastBlockIndex = 0;
uint32 blockRowCount = 0; uint32 blockRowCount = 0;
uint32 stripeRowCount = 0; uint32 stripeRowCount = 0;
StripeMetadata *stripeMetadata = readState->currentStripeMetadata;
stripeRowCount = stripeMetadata->rowCount; stripeRowCount = stripeMetadata->rowCount;
lastBlockIndex = stripeRowCount / stripeMetadata->blockRowCount; lastBlockIndex = stripeRowCount / stripeMetadata->blockRowCount;
@ -989,16 +988,15 @@ DeserializeBlockData(StripeBuffers *stripeBuffers, uint64 blockIndex,
static Datum static Datum
ColumnDefaultValue(TupleConstr *tupleConstraints, Form_pg_attribute attributeForm) ColumnDefaultValue(TupleConstr *tupleConstraints, Form_pg_attribute attributeForm)
{ {
Datum defaultValue = 0;
Node *defaultValueNode = NULL; Node *defaultValueNode = NULL;
int defValIndex = 0; int defValIndex = 0;
for (defValIndex = 0; defValIndex < tupleConstraints->num_defval; defValIndex++) for (defValIndex = 0; defValIndex < tupleConstraints->num_defval; defValIndex++)
{ {
AttrDefault defaultValue = tupleConstraints->defval[defValIndex]; AttrDefault attrDefault = tupleConstraints->defval[defValIndex];
if (defaultValue.adnum == attributeForm->attnum) if (attrDefault.adnum == attributeForm->attnum)
{ {
defaultValueNode = stringToNode(defaultValue.adbin); defaultValueNode = stringToNode(attrDefault.adbin);
break; break;
} }
} }
@ -1010,7 +1008,7 @@ ColumnDefaultValue(TupleConstr *tupleConstraints, Form_pg_attribute attributeFor
if (IsA(defaultValueNode, Const)) if (IsA(defaultValueNode, Const))
{ {
Const *constNode = (Const *) defaultValueNode; Const *constNode = (Const *) defaultValueNode;
defaultValue = constNode->constvalue; return constNode->constvalue;
} }
else else
{ {
@ -1019,8 +1017,6 @@ ColumnDefaultValue(TupleConstr *tupleConstraints, Form_pg_attribute attributeFor
errhint("Expression is either mutable or " errhint("Expression is either mutable or "
"does not evaluate to constant value"))); "does not evaluate to constant value")));
} }
return defaultValue;
} }

View File

@ -386,8 +386,8 @@ WriteToSmgr(TableWriteState *writeState, char *data, uint32 dataLength)
while (addr.blockno >= nblocks) while (addr.blockno >= nblocks)
{ {
Buffer buffer = ReadBuffer(rel, P_NEW); Buffer newBuffer = ReadBuffer(rel, P_NEW);
ReleaseBuffer(buffer); ReleaseBuffer(newBuffer);
nblocks = smgrnblocks(rel->rd_smgr, MAIN_FORKNUM); nblocks = smgrnblocks(rel->rd_smgr, MAIN_FORKNUM);
} }
@ -534,7 +534,6 @@ FlushStripe(TableWriteState *writeState)
for (columnIndex = 0; columnIndex < columnCount; columnIndex++) for (columnIndex = 0; columnIndex < columnCount; columnIndex++)
{ {
ColumnBuffers *columnBuffers = stripeBuffers->columnBuffersArray[columnIndex]; ColumnBuffers *columnBuffers = stripeBuffers->columnBuffersArray[columnIndex];
uint32 blockIndex = 0;
for (blockIndex = 0; blockIndex < stripeSkipList->blockCount; blockIndex++) for (blockIndex = 0; blockIndex < stripeSkipList->blockCount; blockIndex++)
{ {