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

Commit9a85103

Browse files
committed
Remove still more useless assignments.
Fix some more things scan-build pointed to as dead stores. In some ofthese cases, rearranging the code a little leads to more readablecode IMO. It's all cosmetic, though.Discussion:https://postgr.es/m/CAEudQAo1+AcGppxDSg8k+zF4+Kv+eJyqzEDdbpDg58-=MQcerQ@mail.gmail.com
1 parent0852006 commit9a85103

File tree

4 files changed

+24
-39
lines changed

4 files changed

+24
-39
lines changed

‎src/backend/replication/slotfuncs.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -518,9 +518,6 @@ pg_logical_replication_slot_advance(XLogRecPtr moveto)
518518
*/
519519
XLogBeginRead(ctx->reader,MyReplicationSlot->data.restart_lsn);
520520

521-
/* Initialize our return value in case we don't do anything */
522-
retlsn=MyReplicationSlot->data.confirmed_flush;
523-
524521
/* invalidate non-timetravel entries */
525522
InvalidateSystemCaches();
526523

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

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6434,13 +6434,12 @@ float4_to_char(PG_FUNCTION_ARGS)
64346434
intout_pre_spaces=0,
64356435
sign=0;
64366436
char*numstr,
6437-
*orgnum,
64386437
*p;
64396438

64406439
NUM_TOCHAR_prepare;
64416440

64426441
if (IS_ROMAN(&Num))
6443-
numstr=orgnum=int_to_roman((int)rint(value));
6442+
numstr=int_to_roman((int)rint(value));
64446443
elseif (IS_EEEE(&Num))
64456444
{
64466445
if (isnan(value)||isinf(value))
@@ -6456,20 +6455,19 @@ float4_to_char(PG_FUNCTION_ARGS)
64566455
}
64576456
else
64586457
{
6459-
numstr=orgnum=psprintf("%+.*e",Num.post,value);
6458+
numstr=psprintf("%+.*e",Num.post,value);
64606459

64616460
/*
64626461
* Swap a leading positive sign for a space.
64636462
*/
6464-
if (*orgnum=='+')
6465-
*orgnum=' ';
6466-
6467-
numstr=orgnum;
6463+
if (*numstr=='+')
6464+
*numstr=' ';
64686465
}
64696466
}
64706467
else
64716468
{
64726469
float4val=value;
6470+
char*orgnum;
64736471
intnumstr_pre_len;
64746472

64756473
if (IS_MULTI(&Num))
@@ -6480,7 +6478,7 @@ float4_to_char(PG_FUNCTION_ARGS)
64806478
Num.pre+=Num.multi;
64816479
}
64826480

6483-
orgnum=(char*)psprintf("%.0f",fabs(val));
6481+
orgnum=psprintf("%.0f",fabs(val));
64846482
numstr_pre_len=strlen(orgnum);
64856483

64866484
/* adjust post digits to fit max float digits */
@@ -6538,13 +6536,12 @@ float8_to_char(PG_FUNCTION_ARGS)
65386536
intout_pre_spaces=0,
65396537
sign=0;
65406538
char*numstr,
6541-
*orgnum,
65426539
*p;
65436540

65446541
NUM_TOCHAR_prepare;
65456542

65466543
if (IS_ROMAN(&Num))
6547-
numstr=orgnum=int_to_roman((int)rint(value));
6544+
numstr=int_to_roman((int)rint(value));
65486545
elseif (IS_EEEE(&Num))
65496546
{
65506547
if (isnan(value)||isinf(value))
@@ -6560,20 +6557,19 @@ float8_to_char(PG_FUNCTION_ARGS)
65606557
}
65616558
else
65626559
{
6563-
numstr=orgnum= (char*)psprintf("%+.*e",Num.post,value);
6560+
numstr=psprintf("%+.*e",Num.post,value);
65646561

65656562
/*
65666563
* Swap a leading positive sign for a space.
65676564
*/
6568-
if (*orgnum=='+')
6569-
*orgnum=' ';
6570-
6571-
numstr=orgnum;
6565+
if (*numstr=='+')
6566+
*numstr=' ';
65726567
}
65736568
}
65746569
else
65756570
{
65766571
float8val=value;
6572+
char*orgnum;
65776573
intnumstr_pre_len;
65786574

65796575
if (IS_MULTI(&Num))
@@ -6583,6 +6579,7 @@ float8_to_char(PG_FUNCTION_ARGS)
65836579
val=value*multi;
65846580
Num.pre+=Num.multi;
65856581
}
6582+
65866583
orgnum=psprintf("%.0f",fabs(val));
65876584
numstr_pre_len=strlen(orgnum);
65886585

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

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4687,24 +4687,24 @@ IteratorConcat(JsonbIterator **it1, JsonbIterator **it2,
46874687
rk1,
46884688
rk2;
46894689

4690-
r1=rk1=JsonbIteratorNext(it1,&v1, false);
4691-
r2=rk2=JsonbIteratorNext(it2,&v2, false);
4690+
rk1=JsonbIteratorNext(it1,&v1, false);
4691+
rk2=JsonbIteratorNext(it2,&v2, false);
46924692

46934693
/*
46944694
* Both elements are objects.
46954695
*/
46964696
if (rk1==WJB_BEGIN_OBJECT&&rk2==WJB_BEGIN_OBJECT)
46974697
{
46984698
/*
4699-
* Appendtheall tokens from v1 to res, except last WJB_END_OBJECT
4699+
* Append all the tokens from v1 to res, except last WJB_END_OBJECT
47004700
* (because res will not be finished yet).
47014701
*/
4702-
pushJsonbValue(state,r1,NULL);
4702+
pushJsonbValue(state,rk1,NULL);
47034703
while ((r1=JsonbIteratorNext(it1,&v1, true))!=WJB_END_OBJECT)
47044704
pushJsonbValue(state,r1,&v1);
47054705

47064706
/*
4707-
* Appendtheall tokens from v2 to res, include last WJB_END_OBJECT
4707+
* Append all the tokens from v2 to res, include last WJB_END_OBJECT
47084708
* (the concatenation will be completed).
47094709
*/
47104710
while ((r2=JsonbIteratorNext(it2,&v2, true))!=WJB_DONE)
@@ -4716,7 +4716,7 @@ IteratorConcat(JsonbIterator **it1, JsonbIterator **it2,
47164716
*/
47174717
elseif (rk1==WJB_BEGIN_ARRAY&&rk2==WJB_BEGIN_ARRAY)
47184718
{
4719-
pushJsonbValue(state,r1,NULL);
4719+
pushJsonbValue(state,rk1,NULL);
47204720

47214721
while ((r1=JsonbIteratorNext(it1,&v1, true))!=WJB_END_ARRAY)
47224722
{
@@ -4736,10 +4736,8 @@ IteratorConcat(JsonbIterator **it1, JsonbIterator **it2,
47364736
elseif (((rk1==WJB_BEGIN_ARRAY&& !(*it1)->isScalar)&&rk2==WJB_BEGIN_OBJECT)||
47374737
(rk1==WJB_BEGIN_OBJECT&& (rk2==WJB_BEGIN_ARRAY&& !(*it2)->isScalar)))
47384738
{
4739-
47404739
JsonbIterator**it_array=rk1==WJB_BEGIN_ARRAY ?it1 :it2;
47414740
JsonbIterator**it_object=rk1==WJB_BEGIN_OBJECT ?it1 :it2;
4742-
47434741
boolprepend= (rk1==WJB_BEGIN_OBJECT);
47444742

47454743
pushJsonbValue(state,WJB_BEGIN_ARRAY,NULL);

‎src/bin/scripts/vacuumdb.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,6 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
408408
inti;
409409
intntups;
410410
boolfailed= false;
411-
boolparallel=concurrentCons>1;
412411
booltables_listed= false;
413412
boolhas_where= false;
414413
constchar*stage_commands[]= {
@@ -651,25 +650,19 @@ vacuum_one_database(const char *dbname, vacuumingOptions *vacopts,
651650
PQclear(res);
652651

653652
/*
654-
* If there are more connections than vacuumable relations, we don't need
655-
* to use them all.
653+
*Ensure concurrentCons is sane.If there are more connections than
654+
*vacuumable relations, we don't needto use them all.
656655
*/
657-
if (parallel)
658-
{
659-
if (concurrentCons>ntups)
660-
concurrentCons=ntups;
661-
if (concurrentCons <=1)
662-
parallel= false;
663-
}
656+
if (concurrentCons>ntups)
657+
concurrentCons=ntups;
658+
if (concurrentCons <=0)
659+
concurrentCons=1;
664660

665661
/*
666662
* Setup the database connections. We reuse the connection we already have
667663
* for the first slot. If not in parallel mode, the first slot in the
668664
* array contains the connection.
669665
*/
670-
if (concurrentCons <=0)
671-
concurrentCons=1;
672-
673666
slots=ParallelSlotsSetup(dbname,host,port,username,prompt_password,
674667
progname,echo,conn,concurrentCons);
675668

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp