Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita5cc4da

Browse files
committed
Yet more elimination of dead stores and useless initializations.
I'm not sure what tool Ranier was using, but the ones I contributedwere found by using a newer version of scan-build than I tried before.Ranier Vilela and Tom LaneDiscussion:https://postgr.es/m/CAEudQAo1+AcGppxDSg8k+zF4+Kv+eJyqzEDdbpDg58-=MQcerQ@mail.gmail.com
1 parent8febfd1 commita5cc4da

File tree

10 files changed

+22
-28
lines changed

10 files changed

+22
-28
lines changed

‎src/backend/access/common/heaptuple.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -736,7 +736,7 @@ expand_tuple(HeapTuple *targetHeapTuple,
736736
{
737737
AttrMissing*attrmiss=NULL;
738738
intattnum;
739-
intfirstmissingnum=0;
739+
intfirstmissingnum;
740740
boolhasNulls=HeapTupleHasNulls(sourceTuple);
741741
HeapTupleHeadertargetTHeader;
742742
HeapTupleHeadersourceTHeader=sourceTuple->t_data;

‎src/backend/access/gist/gistutil.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
void
3333
gistfillbuffer(Pagepage,IndexTuple*itup,intlen,OffsetNumberoff)
3434
{
35-
OffsetNumberl=InvalidOffsetNumber;
3635
inti;
3736

3837
if (off==InvalidOffsetNumber)
@@ -42,6 +41,7 @@ gistfillbuffer(Page page, IndexTuple *itup, int len, OffsetNumber off)
4241
for (i=0;i<len;i++)
4342
{
4443
Sizesz=IndexTupleSize(itup[i]);
44+
OffsetNumberl;
4545

4646
l=PageAddItem(page, (Item)itup[i],sz,off, false, false);
4747
if (l==InvalidOffsetNumber)

‎src/backend/access/nbtree/nbtsearch.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ _bt_first(IndexScanDesc scan, ScanDirection dir)
860860
ScanKeyDatanotnullkeys[INDEX_MAX_KEYS];
861861
intkeysCount=0;
862862
inti;
863-
boolstatus= true;
863+
boolstatus;
864864
StrategyNumberstrat_total;
865865
BTScanPosItem*currItem;
866866
BlockNumberblkno;
@@ -1858,7 +1858,7 @@ _bt_steppage(IndexScanDesc scan, ScanDirection dir)
18581858
{
18591859
BTScanOpaqueso= (BTScanOpaque)scan->opaque;
18601860
BlockNumberblkno=InvalidBlockNumber;
1861-
boolstatus= true;
1861+
boolstatus;
18621862

18631863
Assert(BTScanPosIsValid(so->currPos));
18641864

@@ -1967,7 +1967,7 @@ _bt_readnextpage(IndexScanDesc scan, BlockNumber blkno, ScanDirection dir)
19671967
Relationrel;
19681968
Pagepage;
19691969
BTPageOpaqueopaque;
1970-
boolstatus= true;
1970+
boolstatus;
19711971

19721972
rel=scan->indexRelation;
19731973

‎src/backend/catalog/storage.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ smgrDoPendingDeletes(bool isCommit)
599599
PendingRelDelete*prev;
600600
PendingRelDelete*next;
601601
intnrels=0,
602-
i=0,
603602
maxrels=0;
604603
SMgrRelation*srels=NULL;
605604

@@ -650,7 +649,7 @@ smgrDoPendingDeletes(bool isCommit)
650649
{
651650
smgrdounlinkall(srels,nrels, false);
652651

653-
for (i=0;i<nrels;i++)
652+
for (inti=0;i<nrels;i++)
654653
smgrclose(srels[i]);
655654

656655
pfree(srels);

‎src/backend/commands/async.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,7 +1918,6 @@ static void
19181918
asyncQueueReadAllNotifications(void)
19191919
{
19201920
volatileQueuePositionpos;
1921-
QueuePositionoldpos;
19221921
QueuePositionhead;
19231922
Snapshotsnapshot;
19241923

@@ -1933,7 +1932,7 @@ asyncQueueReadAllNotifications(void)
19331932
LWLockAcquire(NotifyQueueLock,LW_SHARED);
19341933
/* Assert checks that we have a valid state entry */
19351934
Assert(MyProcPid==QUEUE_BACKEND_PID(MyBackendId));
1936-
pos=oldpos=QUEUE_BACKEND_POS(MyBackendId);
1935+
pos=QUEUE_BACKEND_POS(MyBackendId);
19371936
head=QUEUE_HEAD;
19381937
LWLockRelease(NotifyQueueLock);
19391938

‎src/backend/storage/ipc/procarray.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3433,7 +3433,6 @@ CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending)
34333433
{
34343434
ProcArrayStruct*arrayP=procArray;
34353435
intindex;
3436-
pid_tpid=0;
34373436

34383437
/* tell all backends to die */
34393438
LWLockAcquire(ProcArrayLock,LW_EXCLUSIVE);
@@ -3446,6 +3445,7 @@ CancelDBBackends(Oid databaseid, ProcSignalReason sigmode, bool conflictPending)
34463445
if (databaseid==InvalidOid||proc->databaseId==databaseid)
34473446
{
34483447
VirtualTransactionIdprocvxid;
3448+
pid_tpid;
34493449

34503450
GET_VXID_FROM_PGPROC(procvxid,*proc);
34513451

‎src/backend/tsearch/spell.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1710,7 +1710,7 @@ void
17101710
NISortDictionary(IspellDict*Conf)
17111711
{
17121712
inti;
1713-
intnaffix=0;
1713+
intnaffix;
17141714
intcuraffix;
17151715

17161716
/* compress affixes */

‎src/backend/utils/adt/formatting.c‎

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,7 @@ static const char *
15101510
get_th(char*num,inttype)
15111511
{
15121512
intlen=strlen(num),
1513-
last,
1514-
seclast;
1513+
last;
15151514

15161515
last=*(num+ (len-1));
15171516
if (!isdigit((unsignedchar)last))
@@ -1523,7 +1522,7 @@ get_th(char *num, int type)
15231522
* All "teens" (<x>1[0-9]) get 'TH/th', while <x>[02-9][123] still get
15241523
* 'ST/st', 'ND/nd', 'RD/rd', respectively
15251524
*/
1526-
if ((len>1)&& ((seclast=num[len-2])=='1'))
1525+
if ((len>1)&& (num[len-2]=='1'))
15271526
last=0;
15281527

15291528
switch (last)
@@ -4932,9 +4931,9 @@ NUM_cache(int len, NUMDesc *Num, text *pars_str, bool *shouldFree)
49324931
staticchar*
49334932
int_to_roman(intnumber)
49344933
{
4935-
intlen=0,
4936-
num=0;
4937-
char*p=NULL,
4934+
intlen,
4935+
num;
4936+
char*p,
49384937
*result,
49394938
numstr[12];
49404939

@@ -4950,7 +4949,7 @@ int_to_roman(int number)
49504949

49514950
for (p=numstr;*p!='\0';p++,--len)
49524951
{
4953-
num=*p-49;/* 48 ascii+ 1 */
4952+
num=*p-('0'+1);
49544953
if (num<0)
49554954
continue;
49564955

@@ -6118,7 +6117,7 @@ numeric_to_char(PG_FUNCTION_ARGS)
61186117
x=DatumGetNumeric(DirectFunctionCall2(numeric_round,
61196118
NumericGetDatum(value),
61206119
Int32GetDatum(0)));
6121-
numstr=orgnum=
6120+
numstr=
61226121
int_to_roman(DatumGetInt32(DirectFunctionCall1(numeric_int4,
61236122
NumericGetDatum(x))));
61246123
}
@@ -6239,7 +6238,7 @@ int4_to_char(PG_FUNCTION_ARGS)
62396238
* On DateType depend part (int32)
62406239
*/
62416240
if (IS_ROMAN(&Num))
6242-
numstr=orgnum=int_to_roman(value);
6241+
numstr=int_to_roman(value);
62436242
elseif (IS_EEEE(&Num))
62446243
{
62456244
/* we can do it easily because float8 won't lose any precision */
@@ -6335,7 +6334,7 @@ int8_to_char(PG_FUNCTION_ARGS)
63356334
if (IS_ROMAN(&Num))
63366335
{
63376336
/* Currently don't support int8 conversion to roman... */
6338-
numstr=orgnum=int_to_roman(DatumGetInt32(DirectFunctionCall1(int84,Int64GetDatum(value))));
6337+
numstr=int_to_roman(DatumGetInt32(DirectFunctionCall1(int84,Int64GetDatum(value))));
63396338
}
63406339
elseif (IS_EEEE(&Num))
63416340
{

‎src/backend/utils/adt/tsrank.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,8 +857,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method)
857857
doubleWdoc=0.0;
858858
doubleinvws[lengthof(weights)];
859859
doubleSumDist=0.0,
860-
PrevExtPos=0.0,
861-
CurExtPos=0.0;
860+
PrevExtPos=0.0;
862861
intNExtent=0;
863862
QueryRepresentationqr;
864863

@@ -889,6 +888,7 @@ calc_rank_cd(const float4 *arrdata, TSVector txt, TSQuery query, int method)
889888
{
890889
doubleCpos=0.0;
891890
doubleInvSum=0.0;
891+
doubleCurExtPos;
892892
intnNoise;
893893
DocRepresentation*ptr=ext.begin;
894894

‎src/bin/pg_dump/pg_backup_custom.c‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,6 @@ _skipData(ArchiveHandle *AH)
619619
size_tblkLen;
620620
char*buf=NULL;
621621
intbuflen=0;
622-
size_tcnt;
623622

624623
blkLen=ReadInt(AH);
625624
while (blkLen!=0)
@@ -638,7 +637,7 @@ _skipData(ArchiveHandle *AH)
638637
buf= (char*)pg_malloc(blkLen);
639638
buflen=blkLen;
640639
}
641-
if ((cnt=fread(buf,1,blkLen,AH->FH))!=blkLen)
640+
if (fread(buf,1,blkLen,AH->FH)!=blkLen)
642641
{
643642
if (feof(AH->FH))
644643
fatal("could not read from input file: end of file");
@@ -664,9 +663,7 @@ _skipData(ArchiveHandle *AH)
664663
staticint
665664
_WriteByte(ArchiveHandle*AH,constinti)
666665
{
667-
intres;
668-
669-
if ((res=fputc(i,AH->FH))==EOF)
666+
if (fputc(i,AH->FH)==EOF)
670667
WRITE_ERROR_EXIT;
671668

672669
return1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp