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

Commit303e089

Browse files
committed
Clean up possibly-uninitialized-variable warnings reported by gcc 4.x.
1 parent5d9c6b1 commit303e089

File tree

17 files changed

+167
-126
lines changed

17 files changed

+167
-126
lines changed

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

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.124 2005/08/11 13:22:33 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.125 2005/09/2422:54:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -49,8 +49,7 @@ static void _bt_insertonpg(Relation rel, Buffer buf,
4949
boolsplit_only_page);
5050
staticBuffer_bt_split(Relationrel,Bufferbuf,OffsetNumberfirstright,
5151
OffsetNumbernewitemoff,Sizenewitemsz,
52-
BTItemnewitem,boolnewitemonleft,
53-
OffsetNumber*itup_off,BlockNumber*itup_blkno);
52+
BTItemnewitem,boolnewitemonleft);
5453
staticOffsetNumber_bt_findsplitloc(Relationrel,Pagepage,
5554
OffsetNumbernewitemoff,
5655
Sizenewitemsz,
@@ -365,8 +364,6 @@ _bt_insertonpg(Relation rel,
365364
{
366365
Pagepage;
367366
BTPageOpaquelpageop;
368-
OffsetNumberitup_off;
369-
BlockNumberitup_blkno;
370367
OffsetNumbernewitemoff;
371368
OffsetNumberfirstright=InvalidOffsetNumber;
372369
Sizeitemsz;
@@ -490,8 +487,7 @@ _bt_insertonpg(Relation rel,
490487

491488
/* split the buffer into left and right halves */
492489
rbuf=_bt_split(rel,buf,firstright,
493-
newitemoff,itemsz,btitem,newitemonleft,
494-
&itup_off,&itup_blkno);
490+
newitemoff,itemsz,btitem,newitemonleft);
495491

496492
/*----------
497493
* By here,
@@ -516,6 +512,8 @@ _bt_insertonpg(Relation rel,
516512
Buffermetabuf=InvalidBuffer;
517513
Pagemetapg=NULL;
518514
BTMetaPageData*metad=NULL;
515+
OffsetNumberitup_off;
516+
BlockNumberitup_blkno;
519517

520518
itup_off=newitemoff;
521519
itup_blkno=BufferGetBlockNumber(buf);
@@ -640,14 +638,12 @@ _bt_insertonpg(Relation rel,
640638
*must be inserted along with the data from the old page.
641639
*
642640
*Returns the new right sibling of buf, pinned and write-locked.
643-
*The pin and lock on buf are maintained. *itup_off and *itup_blkno
644-
*are set to the exact location where newitem was inserted.
641+
*The pin and lock on buf are maintained.
645642
*/
646643
staticBuffer
647644
_bt_split(Relationrel,Bufferbuf,OffsetNumberfirstright,
648645
OffsetNumbernewitemoff,Sizenewitemsz,BTItemnewitem,
649-
boolnewitemonleft,
650-
OffsetNumber*itup_off,BlockNumber*itup_blkno)
646+
boolnewitemonleft)
651647
{
652648
Bufferrbuf;
653649
Pageorigpage;
@@ -659,6 +655,8 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
659655
Buffersbuf=InvalidBuffer;
660656
Pagespage=NULL;
661657
BTPageOpaquesopaque=NULL;
658+
OffsetNumberitup_off=0;
659+
BlockNumberitup_blkno=0;
662660
Sizeitemsz;
663661
ItemIditemid;
664662
BTItemitem;
@@ -752,16 +750,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
752750
{
753751
_bt_pgaddtup(rel,leftpage,newitemsz,newitem,leftoff,
754752
"left sibling");
755-
*itup_off=leftoff;
756-
*itup_blkno=BufferGetBlockNumber(buf);
753+
itup_off=leftoff;
754+
itup_blkno=BufferGetBlockNumber(buf);
757755
leftoff=OffsetNumberNext(leftoff);
758756
}
759757
else
760758
{
761759
_bt_pgaddtup(rel,rightpage,newitemsz,newitem,rightoff,
762760
"right sibling");
763-
*itup_off=rightoff;
764-
*itup_blkno=BufferGetBlockNumber(rbuf);
761+
itup_off=rightoff;
762+
itup_blkno=BufferGetBlockNumber(rbuf);
765763
rightoff=OffsetNumberNext(rightoff);
766764
}
767765
}
@@ -788,16 +786,16 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
788786
{
789787
_bt_pgaddtup(rel,leftpage,newitemsz,newitem,leftoff,
790788
"left sibling");
791-
*itup_off=leftoff;
792-
*itup_blkno=BufferGetBlockNumber(buf);
789+
itup_off=leftoff;
790+
itup_blkno=BufferGetBlockNumber(buf);
793791
leftoff=OffsetNumberNext(leftoff);
794792
}
795793
else
796794
{
797795
_bt_pgaddtup(rel,rightpage,newitemsz,newitem,rightoff,
798796
"right sibling");
799-
*itup_off=rightoff;
800-
*itup_blkno=BufferGetBlockNumber(rbuf);
797+
itup_off=rightoff;
798+
itup_blkno=BufferGetBlockNumber(rbuf);
801799
rightoff=OffsetNumberNext(rightoff);
802800
}
803801
}
@@ -839,7 +837,7 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
839837
XLogRecDatardata[4];
840838

841839
xlrec.target.node=rel->rd_node;
842-
ItemPointerSet(&(xlrec.target.tid),*itup_blkno,*itup_off);
840+
ItemPointerSet(&(xlrec.target.tid),itup_blkno,itup_off);
843841
if (newitemonleft)
844842
xlrec.otherblk=BufferGetBlockNumber(rbuf);
845843
else

‎src/backend/catalog/pg_proc.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.132 2005/07/07 20:39:57 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/catalog/pg_proc.c,v 1.133 2005/09/24 22:54:35 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -789,21 +789,27 @@ match_prosrc_to_literal(const char *prosrc, const char *literal,
789789
elseif (*literal=='\'')
790790
{
791791
if (literal[1]!='\'')
792-
return false;
792+
gotofail;
793793
literal++;
794794
if (cursorpos>0)
795795
newcp++;
796796
}
797797
chlen=pg_mblen(prosrc);
798798
if (strncmp(prosrc,literal,chlen)!=0)
799-
return false;
799+
gotofail;
800800
prosrc+=chlen;
801801
literal+=chlen;
802802
}
803803

804-
*newcursorpos=newcp;
805-
806804
if (*literal=='\''&&literal[1]!='\'')
805+
{
806+
/* success */
807+
*newcursorpos=newcp;
807808
return true;
809+
}
810+
811+
fail:
812+
/* Must set *newcursorpos to suppress compiler warning */
813+
*newcursorpos=newcp;
808814
return false;
809815
}

‎src/backend/commands/copy.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.250 2005/09/2417:53:12 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.251 2005/09/2422:54:36 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -542,7 +542,10 @@ CopyGetInt32(CopyState cstate, int32 *val)
542542
uint32buf;
543543

544544
if (CopyGetData(cstate,&buf,sizeof(buf),sizeof(buf))!=sizeof(buf))
545+
{
546+
*val=0;/* suppress compiler warning */
545547
return false;
548+
}
546549
*val= (int32)ntohl(buf);
547550
return true;
548551
}
@@ -568,7 +571,10 @@ CopyGetInt16(CopyState cstate, int16 *val)
568571
uint16buf;
569572

570573
if (CopyGetData(cstate,&buf,sizeof(buf),sizeof(buf))!=sizeof(buf))
574+
{
575+
*val=0;/* suppress compiler warning */
571576
return false;
577+
}
572578
*val= (int16)ntohs(buf);
573579
return true;
574580
}

‎src/backend/commands/functioncmds.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.67 2005/09/08 20:07:41 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/commands/functioncmds.c,v 1.68 2005/09/24 22:54:36 tgl Exp $
1414
*
1515
* DESCRIPTION
1616
* These routines take the parse tree and pick out the
@@ -158,6 +158,8 @@ examine_parameter_list(List *parameters, Oid languageOid,
158158
ListCell*x;
159159
inti;
160160

161+
*requiredResultType=InvalidOid;/* default result */
162+
161163
inTypes= (Oid*)palloc(parameterCount*sizeof(Oid));
162164
allTypes= (Datum*)palloc(parameterCount*sizeof(Datum));
163165
paramModes= (Datum*)palloc(parameterCount*sizeof(Datum));
@@ -243,7 +245,6 @@ examine_parameter_list(List *parameters, Oid languageOid,
243245
{
244246
*allParameterTypes=NULL;
245247
*parameterModes=NULL;
246-
*requiredResultType=InvalidOid;
247248
}
248249

249250
if (have_names)
@@ -383,16 +384,22 @@ compute_attributes_sql_style(List *options,
383384
if (as_item)
384385
*as= (List*)as_item->arg;
385386
else
387+
{
386388
ereport(ERROR,
387389
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
388390
errmsg("no function body specified")));
391+
*as=NIL;/* keep compiler quiet */
392+
}
389393

390394
if (language_item)
391395
*language=strVal(language_item->arg);
392396
else
397+
{
393398
ereport(ERROR,
394399
(errcode(ERRCODE_INVALID_FUNCTION_DEFINITION),
395400
errmsg("no language specified")));
401+
*language=NULL;/* keep compiler quiet */
402+
}
396403

397404
/* process optional items */
398405
if (volatility_item)

‎src/backend/commands/tablecmds.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.170 2005/08/26 03:07:16 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/commands/tablecmds.c,v 1.171 2005/09/24 22:54:36 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -4109,6 +4109,8 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
41094109
* look up each one in the pg_index syscache until we find one marked
41104110
* primary key (hopefully there isn't more than one such).
41114111
*/
4112+
*indexOid=InvalidOid;
4113+
41124114
indexoidlist=RelationGetIndexList(pkrel);
41134115

41144116
foreach(indexoidscan,indexoidlist)
@@ -4127,15 +4129,14 @@ transformFkeyGetPrimaryKey(Relation pkrel, Oid *indexOid,
41274129
break;
41284130
}
41294131
ReleaseSysCache(indexTuple);
4130-
indexStruct=NULL;
41314132
}
41324133

41334134
list_free(indexoidlist);
41344135

41354136
/*
41364137
* Check that we found it
41374138
*/
4138-
if (indexStruct==NULL)
4139+
if (!OidIsValid(*indexOid))
41394140
ereport(ERROR,
41404141
(errcode(ERRCODE_UNDEFINED_OBJECT),
41414142
errmsg("there is no primary key for referenced table \"%s\"",

‎src/backend/optimizer/path/indxpath.c

Lines changed: 19 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.189 2005/09/22 23:25:07 tgl Exp $
12+
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.190 2005/09/24 22:54:36 tgl Exp $
1313
*
1414
*-------------------------------------------------------------------------
1515
*/
@@ -65,10 +65,9 @@ static bool matches_any_index(RestrictInfo *rinfo, RelOptInfo *rel,
6565
Relidsouter_relids);
6666
staticList*find_clauses_for_join(PlannerInfo*root,RelOptInfo*rel,
6767
Relidsouter_relids,boolisouterjoin);
68-
staticboolmatch_variant_ordering(PlannerInfo*root,
69-
IndexOptInfo*index,
70-
List*restrictclauses,
71-
ScanDirection*indexscandir);
68+
staticScanDirectionmatch_variant_ordering(PlannerInfo*root,
69+
IndexOptInfo*index,
70+
List*restrictclauses);
7271
staticList*identify_ignorable_ordering_cols(PlannerInfo*root,
7372
IndexOptInfo*index,
7473
List*restrictclauses);
@@ -362,15 +361,15 @@ find_usable_indexes(PlannerInfo *root, RelOptInfo *rel,
362361
root->query_pathkeys!=NIL&&
363362
pathkeys_useful_for_ordering(root,useful_pathkeys)==0)
364363
{
365-
ScanDirectionindexscandir;
364+
ScanDirectionscandir;
366365

367-
if (match_variant_ordering(root,index,restrictclauses,
368-
&indexscandir))
366+
scandir=match_variant_ordering(root,index,restrictclauses);
367+
if (!ScanDirectionIsNoMovement(scandir))
369368
{
370369
ipath=create_index_path(root,index,
371370
restrictclauses,
372371
root->query_pathkeys,
373-
indexscandir,
372+
scandir,
374373
false);
375374
result=lappend(result,ipath);
376375
}
@@ -1304,15 +1303,14 @@ find_clauses_for_join(PlannerInfo *root, RelOptInfo *rel,
13041303
* 'restrictclauses' is the list of sublists of restriction clauses
13051304
*matching the columns of the index (NIL if none)
13061305
*
1307-
*Returns TRUE ifable to match the requested query pathkeys,FALSE if not.
1308-
*In the TRUE case, sets '*indexscandir'toeither ForwardScanDirection or
1309-
*BackwardScanDirection to indicate the proper scan direction.
1306+
*Ifable to match the requested query pathkeys,returns either
1307+
*ForwardScanDirection or BackwardScanDirectiontoindicate the proper index
1308+
*scan direction. If no match, returns NoMovementScanDirection.
13101309
*/
1311-
staticbool
1310+
staticScanDirection
13121311
match_variant_ordering(PlannerInfo*root,
13131312
IndexOptInfo*index,
1314-
List*restrictclauses,
1315-
ScanDirection*indexscandir)
1313+
List*restrictclauses)
13161314
{
13171315
List*ignorables;
13181316

@@ -1328,7 +1326,7 @@ match_variant_ordering(PlannerInfo *root,
13281326
* won't cope.
13291327
*/
13301328
if (index->relam!=BTREE_AM_OID)
1331-
returnfalse;
1329+
returnNoMovementScanDirection;
13321330
/*
13331331
* Figure out which index columns can be optionally ignored because
13341332
* they have an equality constraint. This is the same set for either
@@ -1344,17 +1342,13 @@ match_variant_ordering(PlannerInfo *root,
13441342
if (ignorables&&
13451343
match_index_to_query_keys(root,index,ForwardScanDirection,
13461344
ignorables))
1347-
{
1348-
*indexscandir=ForwardScanDirection;
1349-
return true;
1350-
}
1345+
returnForwardScanDirection;
1346+
13511347
if (match_index_to_query_keys(root,index,BackwardScanDirection,
13521348
ignorables))
1353-
{
1354-
*indexscandir=BackwardScanDirection;
1355-
return true;
1356-
}
1357-
return false;
1349+
returnBackwardScanDirection;
1350+
1351+
returnNoMovementScanDirection;
13581352
}
13591353

13601354
/*

‎src/backend/optimizer/plan/createplan.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.197 2005/08/18 17:51:11 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.198 2005/09/24 22:54:37 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -1634,7 +1634,8 @@ fix_indexqual_operand(Node *node, IndexOptInfo *index, Oid *opclass)
16341634

16351635
/* Ooops... */
16361636
elog(ERROR,"node is not an index attribute");
1637-
returnNULL;/* keep compiler quiet */
1637+
*opclass=InvalidOid;/* keep compiler quiet */
1638+
returnNULL;
16381639
}
16391640

16401641
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp