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

Commit7d4c99b

Browse files
committed
Fix pgindent to properly handle 'else' and single-line comments on the
same line; previous fix was only partial. Re-run pgindent on filesthat need it.
1 parentf6e8730 commit7d4c99b

File tree

7 files changed

+209
-169
lines changed

7 files changed

+209
-169
lines changed

‎src/backend/access/transam/slru.c

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* Portions Copyright (c) 1996-2007, PostgreSQL Global Development Group
4242
* Portions Copyright (c) 1994, Regents of the University of California
4343
*
44-
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.41 2007/08/01 22:45:07 tgl Exp $
44+
* $PostgreSQL: pgsql/src/backend/access/transam/slru.c,v 1.42 2007/11/15 23:23:44 momjian Exp $
4545
*
4646
*-------------------------------------------------------------------------
4747
*/
@@ -168,7 +168,7 @@ SimpleLruShmemSize(int nslots, int nlsns)
168168
sz+=MAXALIGN(nslots*sizeof(LWLockId));/* buffer_locks[] */
169169

170170
if (nlsns>0)
171-
sz+=MAXALIGN(nslots*nlsns*sizeof(XLogRecPtr));/* group_lsn[] */
171+
sz+=MAXALIGN(nslots*nlsns*sizeof(XLogRecPtr));/* group_lsn[] */
172172

173173
returnBUFFERALIGN(sz)+BLCKSZ*nslots;
174174
}
@@ -339,7 +339,7 @@ SimpleLruWaitIO(SlruCtl ctl, int slotno)
339339
/* indeed, the I/O must have failed */
340340
if (shared->page_status[slotno]==SLRU_PAGE_READ_IN_PROGRESS)
341341
shared->page_status[slotno]=SLRU_PAGE_EMPTY;
342-
else/* write_in_progress */
342+
else/* write_in_progress */
343343
{
344344
shared->page_status[slotno]=SLRU_PAGE_VALID;
345345
shared->page_dirty[slotno]= true;
@@ -669,21 +669,22 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
669669
intfd=-1;
670670

671671
/*
672-
* Honor the write-WAL-before-data rule, if appropriate, so that we do
673-
*notwrite out data before associated WAL records. This is the same
674-
*actionperformed during FlushBuffer() in the main buffer manager.
672+
* Honor the write-WAL-before-data rule, if appropriate, so that we do not
673+
* write out data before associated WAL records. This is the same action
674+
* performed during FlushBuffer() in the main buffer manager.
675675
*/
676676
if (shared->group_lsn!=NULL)
677677
{
678678
/*
679-
* We must determine the largest async-commit LSN for the page.
680-
*Thisis a bit tedious, but since this entire function is a slow
681-
*pathanyway, it seems better to do this here than to maintain
682-
*a per-pageLSN variable (which'd need an extra comparison in the
679+
* We must determine the largest async-commit LSN for the page. This
680+
* is a bit tedious, but since this entire function is a slow path
681+
* anyway, it seems better to do this here than to maintain a per-page
682+
* LSN variable (which'd need an extra comparison in the
683683
* transaction-commit path).
684684
*/
685685
XLogRecPtrmax_lsn;
686-
intlsnindex,lsnoff;
686+
intlsnindex,
687+
lsnoff;
687688

688689
lsnindex=slotno*shared->lsn_groups_per_page;
689690
max_lsn=shared->group_lsn[lsnindex++];
@@ -699,8 +700,8 @@ SlruPhysicalWritePage(SlruCtl ctl, int pageno, int slotno, SlruFlush fdata)
699700
{
700701
/*
701702
* As noted above, elog(ERROR) is not acceptable here, so if
702-
* XLogFlush were to fail, we must PANIC. This isn't much of
703-
*arestriction because XLogFlush is just about all critical
703+
* XLogFlush were to fail, we must PANIC. This isn't much of a
704+
* restriction because XLogFlush is just about all critical
704705
* section anyway, but let's make sure.
705706
*/
706707
START_CRIT_SECTION();

‎src/backend/commands/trigger.c

Lines changed: 55 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.222 2007/11/05 19:00:25 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/commands/trigger.c,v 1.223 2007/11/15 23:23:44 momjian Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -42,7 +42,7 @@
4242

4343

4444
/* GUC variables */
45-
intSessionReplicationRole=SESSION_REPLICATION_ROLE_ORIGIN;
45+
intSessionReplicationRole=SESSION_REPLICATION_ROLE_ORIGIN;
4646

4747

4848
/* Local function prototypes */
@@ -67,7 +67,7 @@ static void AfterTriggerSaveEvent(ResultRelInfo *relinfo, int event,
6767
*
6868
* constraintOid, if nonzero, says that this trigger is being created
6969
* internally to implement that constraint. A suitable pg_depend entry will
70-
* be made to link the trigger to that constraint.constraintOid is zero when
70+
* be made to link the trigger to that constraint.constraintOid is zero when
7171
* executing a user-entered CREATE TRIGGER command.
7272
*
7373
* Note: can return InvalidOid if we decided to not create a trigger at all,
@@ -211,11 +211,11 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
211211
}
212212

213213
/*
214-
* If the command is a user-entered CREATE CONSTRAINT TRIGGER command
215-
*thatreferences one of the built-in RI_FKey trigger functions, assume
216-
*it isfrom a dump of a pre-7.3 foreign key constraint, and take steps
217-
*toconvert this legacy representation into a regular foreign key
218-
* constraint.Ugly, but necessary for loading old dump files.
214+
* If the command is a user-entered CREATE CONSTRAINT TRIGGER command that
215+
* references one of the built-in RI_FKey trigger functions, assume it is
216+
* from a dump of a pre-7.3 foreign key constraint, and take steps to
217+
* convert this legacy representation into a regular foreign key
218+
* constraint.Ugly, but necessary for loading old dump files.
219219
*/
220220
if (stmt->isconstraint&& !OidIsValid(constraintOid)&&
221221
list_length(stmt->args) >=6&&
@@ -421,8 +421,8 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
421421
{
422422
/*
423423
* It's for a constraint, so make it an internal dependency of the
424-
* constraint.We can skip depending on the relations, as there'll
425-
*bean indirect dependency via the constraint.
424+
* constraint.We can skip depending on the relations, as there'll be
425+
* an indirect dependency via the constraint.
426426
*/
427427
referenced.classId=ConstraintRelationId;
428428
referenced.objectId=constraintOid;
@@ -461,21 +461,22 @@ CreateTrigger(CreateTrigStmt *stmt, Oid constraintOid)
461461
* full-fledged foreign key constraints.
462462
*
463463
* The conversion is complex because a pre-7.3 foreign key involved three
464-
* separate triggers, which were reported separately in dumps.While the
464+
* separate triggers, which were reported separately in dumps.While the
465465
* single trigger on the referencing table adds no new information, we need
466466
* to know the trigger functions of both of the triggers on the referenced
467467
* table to build the constraint declaration. Also, due to lack of proper
468468
* dependency checking pre-7.3, it is possible that the source database had
469469
* an incomplete set of triggers resulting in an only partially enforced
470470
* FK constraint. (This would happen if one of the tables had been dropped
471471
* and re-created, but only if the DB had been affected by a 7.0 pg_dump bug
472-
* that caused loss of tgconstrrelid information.)We choose to translate to
472+
* that caused loss of tgconstrrelid information.)We choose to translate to
473473
* an FK constraint only when we've seen all three triggers of a set. This is
474474
* implemented by storing unmatched items in a list in TopMemoryContext.
475475
* We match triggers together by comparing the trigger arguments (which
476476
* include constraint name, table and column names, so should be good enough).
477477
*/
478-
typedefstruct {
478+
typedefstruct
479+
{
479480
List*args;/* list of (T_String) Values or NIL */
480481
Oidfuncoids[3];/* OIDs of trigger functions */
481482
/* The three function OIDs are stored in the order update, delete, child */
@@ -486,7 +487,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
486487
{
487488
staticList*info_list=NIL;
488489

489-
staticconstchar*constfuncdescr[3]= {
490+
staticconstchar*constfuncdescr[3]= {
490491
gettext_noop("Found referenced table's UPDATE trigger."),
491492
gettext_noop("Found referenced table's DELETE trigger."),
492493
gettext_noop("Found referencing table's trigger.")
@@ -511,7 +512,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
511512
i=0;
512513
foreach(l,stmt->args)
513514
{
514-
Value*arg= (Value*)lfirst(l);
515+
Value*arg= (Value*)lfirst(l);
515516

516517
i++;
517518
if (i<4)/* skip constraint and table names */
@@ -537,7 +538,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
537538
i=0;
538539
foreach(l,fk_attrs)
539540
{
540-
Value*arg= (Value*)lfirst(l);
541+
Value*arg= (Value*)lfirst(l);
541542

542543
if (i++>0)
543544
appendStringInfoChar(&buf,',');
@@ -548,7 +549,7 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
548549
i=0;
549550
foreach(l,pk_attrs)
550551
{
551-
Value*arg= (Value*)lfirst(l);
552+
Value*arg= (Value*)lfirst(l);
552553

553554
if (i++>0)
554555
appendStringInfoChar(&buf,',');
@@ -598,9 +599,9 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
598599
MemoryContextoldContext;
599600

600601
ereport(NOTICE,
601-
(errmsg("ignoring incomplete trigger group for constraint \"%s\" %s",
602-
constr_name,buf.data),
603-
errdetail(funcdescr[funcnum])));
602+
(errmsg("ignoring incomplete trigger group for constraint \"%s\" %s",
603+
constr_name,buf.data),
604+
errdetail(funcdescr[funcnum])));
604605
oldContext=MemoryContextSwitchTo(TopMemoryContext);
605606
info= (OldTriggerInfo*)palloc0(sizeof(OldTriggerInfo));
606607
info->args=copyObject(stmt->args);
@@ -614,9 +615,9 @@ ConvertTriggerToFK(CreateTrigStmt *stmt, Oid funcoid)
614615
{
615616
/* Second trigger of set */
616617
ereport(NOTICE,
617-
(errmsg("ignoring incomplete trigger group for constraint \"%s\" %s",
618-
constr_name,buf.data),
619-
errdetail(funcdescr[funcnum])));
618+
(errmsg("ignoring incomplete trigger group for constraint \"%s\" %s",
619+
constr_name,buf.data),
620+
errdetail(funcdescr[funcnum])));
620621
}
621622
else
622623
{
@@ -1184,8 +1185,8 @@ RelationBuildTriggers(Relation relation)
11841185
inti;
11851186

11861187
val=DatumGetByteaP(fastgetattr(htup,
1187-
Anum_pg_trigger_tgargs,
1188-
tgrel->rd_att,&isnull));
1188+
Anum_pg_trigger_tgargs,
1189+
tgrel->rd_att,&isnull));
11891190
if (isnull)
11901191
elog(ERROR,"tgargs is null in trigger for relation \"%s\"",
11911192
RelationGetRelationName(relation));
@@ -1637,7 +1638,7 @@ ExecBSInsertTriggers(EState *estate, ResultRelInfo *relinfo)
16371638
trigger->tgenabled==TRIGGER_DISABLED)
16381639
continue;
16391640
}
1640-
else/* ORIGIN or LOCAL role */
1641+
else/* ORIGIN or LOCAL role */
16411642
{
16421643
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
16431644
trigger->tgenabled==TRIGGER_DISABLED)
@@ -1696,7 +1697,7 @@ ExecBRInsertTriggers(EState *estate, ResultRelInfo *relinfo,
16961697
trigger->tgenabled==TRIGGER_DISABLED)
16971698
continue;
16981699
}
1699-
else/* ORIGIN or LOCAL role */
1700+
else/* ORIGIN or LOCAL role */
17001701
{
17011702
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
17021703
trigger->tgenabled==TRIGGER_DISABLED)
@@ -1768,7 +1769,7 @@ ExecBSDeleteTriggers(EState *estate, ResultRelInfo *relinfo)
17681769
trigger->tgenabled==TRIGGER_DISABLED)
17691770
continue;
17701771
}
1771-
else/* ORIGIN or LOCAL role */
1772+
else/* ORIGIN or LOCAL role */
17721773
{
17731774
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
17741775
trigger->tgenabled==TRIGGER_DISABLED)
@@ -1834,7 +1835,7 @@ ExecBRDeleteTriggers(EState *estate, ResultRelInfo *relinfo,
18341835
trigger->tgenabled==TRIGGER_DISABLED)
18351836
continue;
18361837
}
1837-
else/* ORIGIN or LOCAL role */
1838+
else/* ORIGIN or LOCAL role */
18381839
{
18391840
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
18401841
trigger->tgenabled==TRIGGER_DISABLED)
@@ -1919,7 +1920,7 @@ ExecBSUpdateTriggers(EState *estate, ResultRelInfo *relinfo)
19191920
trigger->tgenabled==TRIGGER_DISABLED)
19201921
continue;
19211922
}
1922-
else/* ORIGIN or LOCAL role */
1923+
else/* ORIGIN or LOCAL role */
19231924
{
19241925
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
19251926
trigger->tgenabled==TRIGGER_DISABLED)
@@ -1990,7 +1991,7 @@ ExecBRUpdateTriggers(EState *estate, ResultRelInfo *relinfo,
19901991
trigger->tgenabled==TRIGGER_DISABLED)
19911992
continue;
19921993
}
1993-
else/* ORIGIN or LOCAL role */
1994+
else/* ORIGIN or LOCAL role */
19941995
{
19951996
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
19961997
trigger->tgenabled==TRIGGER_DISABLED)
@@ -2669,7 +2670,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events,
26692670
trigdesc=rInfo->ri_TrigDesc;
26702671
finfo=rInfo->ri_TrigFunctions;
26712672
instr=rInfo->ri_TrigInstrument;
2672-
if (trigdesc==NULL)/* should not happen */
2673+
if (trigdesc==NULL)/* should not happen */
26732674
elog(ERROR,"relation %u has no triggers",
26742675
event->ate_relid);
26752676
}
@@ -2725,7 +2726,7 @@ afterTriggerInvokeEvents(AfterTriggerEventList *events,
27252726

27262727
if (local_estate)
27272728
{
2728-
ListCell*l;
2729+
ListCell*l;
27292730

27302731
foreach(l,estate->es_trig_target_relations)
27312732
{
@@ -2905,8 +2906,8 @@ AfterTriggerFireDeferred(void)
29052906
ActiveSnapshot=CopySnapshot(GetTransactionSnapshot());
29062907

29072908
/*
2908-
* Run all the remaining triggers.Loop until they are all gone, in
2909-
*casesome trigger queues more for us to do.
2909+
* Run all the remaining triggers.Loop until they are all gone, in case
2910+
* some trigger queues more for us to do.
29102911
*/
29112912
while (afterTriggerMarkEvents(events,NULL, false))
29122913
{
@@ -2940,13 +2941,13 @@ AfterTriggerEndXact(bool isCommit)
29402941
*
29412942
* Since all the info is in TopTransactionContext or children thereof, we
29422943
* don't really need to do anything to reclaim memory. However, the
2943-
* pending-events list could be large, and so it's useful to discard
2944-
*it assoon as possible --- especially if we are aborting because we
2945-
*ran outof memory for the list!
2944+
* pending-events list could be large, and so it's useful to discard it as
2945+
* soon as possible --- especially if we are aborting because we ran out
2946+
* of memory for the list!
29462947
*
2947-
* (Note: any event_cxts of child subtransactions could also be
2948-
*deletedhere, but we have no convenient way to find them, so we
2949-
*leave it toTopTransactionContext reset to clean them up.)
2948+
* (Note: any event_cxts of child subtransactions could also be deleted
2949+
* here, but we have no convenient way to find them, so we leave it to
2950+
* TopTransactionContext reset to clean them up.)
29502951
*/
29512952
if (afterTriggers&&afterTriggers->event_cxt)
29522953
MemoryContextDelete(afterTriggers->event_cxt);
@@ -2973,9 +2974,8 @@ AfterTriggerBeginSubXact(void)
29732974

29742975
/*
29752976
* Allocate more space in the stacks if needed. (Note: because the
2976-
* minimum nest level of a subtransaction is 2, we waste the first
2977-
* couple entries of each array; not worth the notational effort to
2978-
* avoid it.)
2977+
* minimum nest level of a subtransaction is 2, we waste the first couple
2978+
* entries of each array; not worth the notational effort to avoid it.)
29792979
*/
29802980
while (my_level >=afterTriggers->maxtransdepth)
29812981
{
@@ -3071,16 +3071,17 @@ AfterTriggerEndSubXact(bool isCommit)
30713071
afterTriggers->state_stack[my_level]=NULL;
30723072
Assert(afterTriggers->query_depth==
30733073
afterTriggers->depth_stack[my_level]);
3074+
30743075
/*
30753076
* It's entirely possible that the subxact created an event_cxt but
30763077
* there is not anything left in it (because all the triggers were
3077-
* fired at end-of-statement).If so, we should release the context
3078-
* to prevent memory leakage in a long sequence of subtransactions.
3079-
*Wecan detect whether there's anything of use in the context by
3080-
*seeingif anything was added to the global events list since
3081-
*subxactstart. (This test doesn't catch every case where the
3082-
*context isdeletable; for instance maybe the only additions were
3083-
*from asub-sub-xact. But it handles the common case.)
3078+
* fired at end-of-statement).If so, we should release the context
3079+
* to prevent memory leakage in a long sequence of subtransactions. We
3080+
* can detect whether there's anything of use in the context by seeing
3081+
* if anything was added to the global events list since subxact
3082+
* start. (This test doesn't catch every case where the context is
3083+
* deletable; for instance maybe the only additions were from a
3084+
* sub-sub-xact. But it handles the common case.)
30843085
*/
30853086
if (afterTriggers->cxt_stack[my_level]&&
30863087
afterTriggers->events.tail==afterTriggers->events_stack[my_level].tail)
@@ -3615,7 +3616,7 @@ AfterTriggerSaveEvent(ResultRelInfo *relinfo, int event, bool row_trigger,
36153616
trigger->tgenabled==TRIGGER_DISABLED)
36163617
continue;
36173618
}
3618-
else/* ORIGIN or LOCAL role */
3619+
else/* ORIGIN or LOCAL role */
36193620
{
36203621
if (trigger->tgenabled==TRIGGER_FIRES_ON_REPLICA||
36213622
trigger->tgenabled==TRIGGER_DISABLED)
@@ -3668,10 +3669,10 @@ AfterTriggerSaveEvent(ResultRelInfo *relinfo, int event, bool row_trigger,
36683669

36693670
/*
36703671
* If we don't yet have an event context for the current (sub)xact,
3671-
* create one.Make it a child of CurTransactionContext to ensure it
3672+
* create one.Make it a child of CurTransactionContext to ensure it
36723673
* will go away if the subtransaction aborts.
36733674
*/
3674-
if (my_level>1)/* subtransaction? */
3675+
if (my_level>1)/* subtransaction? */
36753676
{
36763677
Assert(my_level<afterTriggers->maxtransdepth);
36773678
cxtptr=&afterTriggers->cxt_stack[my_level];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp