Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 2aa0476

Browse files
committed
Manual cleanup of pgindent results.
Fix some places where pgindent did silly stuff, often because project style wasn't followed to begin with. (I've not touched the atomics headers, though.)
1 parent 17b48a1 commit 2aa0476

File tree

10 files changed

+68
-87
lines changed

10 files changed

+68
-87
lines changed

contrib/pg_audit/pg_audit.c

+26-50
Original file line numberDiff line numberDiff line change
@@ -212,19 +212,19 @@ typedef struct
212212
int64 statementId; /* Simple counter */
213213
int64 substatementId; /* Simple counter */
214214

215-
LogStmtLevel logStmtLevel; /* From GetCommandLogLevel when possible, */
216-
/* generated when not. */
215+
LogStmtLevel logStmtLevel; /* From GetCommandLogLevel when possible,
216+
* generated when not. */
217217
NodeTag commandTag; /* same here */
218218
const char *command; /* same here */
219-
const char *objectType; /* From event trigger when possible */
220-
/* generated when not. */
219+
const char *objectType; /* From event trigger when possible, generated
220+
* when not. */
221221
char *objectName; /* Fully qualified object identification */
222222
const char *commandText; /* sourceText / queryString */
223223
ParamListInfo paramList; /* QueryDesc/ProcessUtility parameters */
224224

225225
bool granted; /* Audit role has object permissions? */
226-
bool logged; /* Track if we have logged this event, used */
227-
/* post-ProcessUtility to make sure we log */
226+
bool logged; /* Track if we have logged this event, used
227+
* post-ProcessUtility to make sure we log */
228228
bool statementLogged; /* Track if we have logged the statement */
229229
} AuditEvent;
230230

@@ -467,7 +467,7 @@ log_audit_event(AuditEventStackItem *stackItem)
467467
/* Classify the statement using log stmt level and the command tag */
468468
switch (stackItem->auditEvent.logStmtLevel)
469469
{
470-
/* All mods go in WRITE class, execpt EXECUTE */
470+
/* All mods go in WRITE class, except EXECUTE */
471471
case LOGSTMT_MOD:
472472
className = CLASS_WRITE;
473473
class = LOG_WRITE;
@@ -553,13 +553,14 @@ log_audit_event(AuditEventStackItem *stackItem)
553553
break;
554554
}
555555

556-
/*
556+
/*----------
557557
* Only log the statement if:
558558
*
559-
* 1. If object was selected for audit logging (granted) 2. The statement
560-
* belongs to a class that is being logged
559+
* 1. If object was selected for audit logging (granted), or
560+
* 2. The statement belongs to a class that is being logged
561561
*
562562
* If neither of these is true, return.
563+
*----------
563564
*/
564565
if (!stackItem->auditEvent.granted && !(auditLogBitmap & class))
565566
return;
@@ -979,57 +980,39 @@ log_select_dml(Oid auditOid, List *rangeTabls)
979980
switch (rte->relkind)
980981
{
981982
case RELKIND_RELATION:
982-
auditEventStack->auditEvent.objectType =
983-
OBJECT_TYPE_TABLE;
984-
983+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_TABLE;
985984
break;
986985

987986
case RELKIND_INDEX:
988-
auditEventStack->auditEvent.objectType =
989-
OBJECT_TYPE_INDEX;
990-
987+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_INDEX;
991988
break;
992989

993990
case RELKIND_SEQUENCE:
994-
auditEventStack->auditEvent.objectType =
995-
OBJECT_TYPE_SEQUENCE;
996-
991+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_SEQUENCE;
997992
break;
998993

999994
case RELKIND_TOASTVALUE:
1000-
auditEventStack->auditEvent.objectType =
1001-
OBJECT_TYPE_TOASTVALUE;
1002-
995+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_TOASTVALUE;
1003996
break;
1004997

1005998
case RELKIND_VIEW:
1006-
auditEventStack->auditEvent.objectType =
1007-
OBJECT_TYPE_VIEW;
1008-
999+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_VIEW;
10091000
break;
10101001

10111002
case RELKIND_COMPOSITE_TYPE:
1012-
auditEventStack->auditEvent.objectType =
1013-
OBJECT_TYPE_COMPOSITE_TYPE;
1014-
1003+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_COMPOSITE_TYPE;
10151004
break;
10161005

10171006
case RELKIND_FOREIGN_TABLE:
1018-
auditEventStack->auditEvent.objectType =
1019-
OBJECT_TYPE_FOREIGN_TABLE;
1020-
1007+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_FOREIGN_TABLE;
10211008
break;
10221009

10231010
case RELKIND_MATVIEW:
1024-
auditEventStack->auditEvent.objectType =
1025-
OBJECT_TYPE_MATVIEW;
1026-
1011+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_MATVIEW;
10271012
break;
10281013

10291014
default:
1030-
auditEventStack->auditEvent.objectType =
1031-
OBJECT_TYPE_UNKNOWN;
1032-
1015+
auditEventStack->auditEvent.objectType = OBJECT_TYPE_UNKNOWN;
10331016
break;
10341017
}
10351018

@@ -1043,9 +1026,7 @@ log_select_dml(Oid auditOid, List *rangeTabls)
10431026
/* Perform object auditing only if the audit role is valid */
10441027
if (auditOid != InvalidOid)
10451028
{
1046-
AclMode auditPerms =
1047-
(ACL_SELECT | ACL_UPDATE | ACL_INSERT | ACL_DELETE) &
1048-
rte->requiredPerms;
1029+
AclMode auditPerms = (ACL_SELECT | ACL_UPDATE | ACL_INSERT | ACL_DELETE) & rte->requiredPerms;
10491030

10501031
/*
10511032
* If any of the required permissions for the relation are granted
@@ -1166,7 +1147,6 @@ log_function_execute(Oid objectId)
11661147
stackItem->auditEvent.commandTag = T_DoStmt;
11671148
stackItem->auditEvent.command = COMMAND_EXECUTE;
11681149
stackItem->auditEvent.objectType = OBJECT_TYPE_FUNCTION;
1169-
11701150
stackItem->auditEvent.commandText = stackItem->next->auditEvent.commandText;
11711151

11721152
log_audit_event(stackItem);
@@ -1459,8 +1439,7 @@ pg_audit_ddl_command_end(PG_FUNCTION_ARGS)
14591439

14601440
/* Supply object name and type for audit event */
14611441
auditEventStack->auditEvent.objectType =
1462-
SPI_getvalue(spiTuple, spiTupDesc, 1);
1463-
1442+
SPI_getvalue(spiTuple, spiTupDesc, 1);
14641443
auditEventStack->auditEvent.objectName =
14651444
SPI_getvalue(spiTuple, spiTupDesc, 2);
14661445

@@ -1545,8 +1524,7 @@ pg_audit_sql_drop(PG_FUNCTION_ARGS)
15451524
spiTuple = SPI_tuptable->vals[row];
15461525

15471526
auditEventStack->auditEvent.objectType =
1548-
SPI_getvalue(spiTuple, spiTupDesc, 1);
1549-
1527+
SPI_getvalue(spiTuple, spiTupDesc, 1);
15501528
auditEventStack->auditEvent.objectName =
15511529
SPI_getvalue(spiTuple, spiTupDesc, 2);
15521530

@@ -1603,16 +1581,14 @@ check_pg_audit_log(char **newVal, void **extra, GucSource source)
16031581

16041582
foreach(lt, flagRawList)
16051583
{
1584+
char *token = (char *) lfirst(lt);
16061585
bool subtract = false;
16071586
int class;
16081587

1609-
/* Retrieve a token */
1610-
char *token = (char *) lfirst(lt);
1611-
16121588
/* If token is preceded by -, then the token is subtractive */
1613-
if (strstr(token, "-") == token)
1589+
if (token[0] == '-')
16141590
{
1615-
token = token + 1;
1591+
token++;
16161592
subtract = true;
16171593
}
16181594

src/backend/access/tablesample/bernoulli.c

+6-9
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,7 @@ Datum
8080
tsm_bernoulli_nextblock(PG_FUNCTION_ARGS)
8181
{
8282
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
83-
BernoulliSamplerData *sampler =
84-
(BernoulliSamplerData *) tsdesc->tsmdata;
83+
BernoulliSamplerData *sampler = (BernoulliSamplerData *) tsdesc->tsmdata;
8584

8685
/*
8786
* Bernoulli sampling scans all blocks on the table and supports syncscan
@@ -117,10 +116,10 @@ tsm_bernoulli_nextblock(PG_FUNCTION_ARGS)
117116
* tuples have same probability of being returned the visible and invisible
118117
* tuples will be returned in same ratio as they have in the actual table.
119118
* This means that there is no skew towards either visible or invisible tuples
120-
* and the number returned visible tuples to from the executor node is the
121-
* fraction of visible tuples which was specified in input.
119+
* and the number of visible tuples returned from the executor node should
120+
* match the fraction of visible tuples which was specified by user.
122121
*
123-
* This is faster than doing the coinflip in the examinetuple because we don't
122+
* This is faster than doing the coinflip in examinetuple because we don't
124123
* have to do visibility checks on uninteresting tuples.
125124
*
126125
* If we reach end of the block return InvalidOffsetNumber which tells
@@ -131,8 +130,7 @@ tsm_bernoulli_nexttuple(PG_FUNCTION_ARGS)
131130
{
132131
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
133132
OffsetNumber maxoffset = PG_GETARG_UINT16(2);
134-
BernoulliSamplerData *sampler =
135-
(BernoulliSamplerData *) tsdesc->tsmdata;
133+
BernoulliSamplerData *sampler = (BernoulliSamplerData *) tsdesc->tsmdata;
136134
OffsetNumber tupoffset = sampler->lt;
137135
float4 probability = sampler->probability;
138136

@@ -185,8 +183,7 @@ Datum
185183
tsm_bernoulli_reset(PG_FUNCTION_ARGS)
186184
{
187185
TableSampleDesc *tsdesc = (TableSampleDesc *) PG_GETARG_POINTER(0);
188-
BernoulliSamplerData *sampler =
189-
(BernoulliSamplerData *) tsdesc->tsmdata;
186+
BernoulliSamplerData *sampler = (BernoulliSamplerData *) tsdesc->tsmdata;
190187

191188
sampler->blockno = InvalidBlockNumber;
192189
sampler->lt = InvalidOffsetNumber;

src/backend/access/tablesample/tablesample.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,12 @@ tablesample_init(SampleScanState *scanstate, TableSampleClause *tablesample)
7878
fcinfo.argnull[0] = false;
7979

8080
/*
81-
* Second arg for init function is always REPEATABLE When
82-
* tablesample->repeatable is NULL then REPEATABLE clause was not
83-
* specified. When specified, the expression cannot evaluate to NULL.
81+
* Second arg for init function is always REPEATABLE.
82+
*
83+
* If tablesample->repeatable is NULL then REPEATABLE clause was not
84+
* specified, and we insert a random value as default.
85+
*
86+
* When specified, the expression cannot evaluate to NULL.
8487
*/
8588
if (tablesample->repeatable)
8689
{

src/backend/executor/execUtils.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -645,10 +645,12 @@ get_last_attnums(Node *node, ProjectionInfo *projInfo)
645645
* overall targetlist's econtext. GroupingFunc arguments are never
646646
* evaluated at all.
647647
*/
648-
if (IsA(node, Aggref) ||IsA(node, GroupingFunc))
648+
if (IsA(node, Aggref))
649649
return false;
650650
if (IsA(node, WindowFunc))
651651
return false;
652+
if (IsA(node, GroupingFunc))
653+
return false;
652654
return expression_tree_walker(node, get_last_attnums,
653655
(void *) projInfo);
654656
}

src/backend/executor/nodeAgg.c

+5-3
Original file line numberDiff line numberDiff line change
@@ -1519,8 +1519,9 @@ agg_retrieve_direct(AggState *aggstate)
15191519
/*
15201520
* get state info from node
15211521
*
1522-
* econtext is the per-output-tuple expression context tmpcontext is the
1523-
* per-input-tuple expression context
1522+
* econtext is the per-output-tuple expression context
1523+
*
1524+
* tmpcontext is the per-input-tuple expression context
15241525
*/
15251526
econtext = aggstate->ss.ps.ps_ExprContext;
15261527
tmpcontext = aggstate->tmpcontext;
@@ -1609,7 +1610,7 @@ agg_retrieve_direct(AggState *aggstate)
16091610
else
16101611
nextSetSize = 0;
16111612

1612-
/*-
1613+
/*----------
16131614
* If a subgroup for the current grouping set is present, project it.
16141615
*
16151616
* We have a new group if:
@@ -1624,6 +1625,7 @@ agg_retrieve_direct(AggState *aggstate)
16241625
* AND
16251626
* - the previous and pending rows differ on the grouping columns
16261627
* of the next grouping set
1628+
*----------
16271629
*/
16281630
if (aggstate->input_done ||
16291631
(node->aggstrategy == AGG_SORTED &&

src/backend/executor/nodeHash.c

+4-4
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew,
527527
* Buckets are simple pointers to hashjoin tuples, while tupsize
528528
* includes the pointer, hash code, and MinimalTupleData. So buckets
529529
* should never really exceed 25% of work_mem (even for
530-
* NTUP_PER_BUCKET=1); except maybe * for work_mem values that are not
531-
* 2^N bytes, where we might get more * because of doubling. So let's
530+
* NTUP_PER_BUCKET=1); except maybe for work_mem values that are not
531+
* 2^N bytes, where we might get more because of doubling. So let's
532532
* look for 50% here.
533533
*/
534534
Assert(bucket_bytes <= hash_table_bytes / 2);
@@ -691,9 +691,9 @@ ExecHashIncreaseNumBatches(HashJoinTable hashtable)
691691
if (batchno == curbatch)
692692
{
693693
/* keep tuple in memory - copy it into the new chunk */
694-
HashJoinTuple copyTuple =
695-
(HashJoinTuple) dense_alloc(hashtable, hashTupleSize);
694+
HashJoinTuple copyTuple;
696695

696+
copyTuple = (HashJoinTuple) dense_alloc(hashtable, hashTupleSize);
697697
memcpy(copyTuple, hashTuple, hashTupleSize);
698698

699699
/* and add it back to the appropriate bucket */

src/backend/optimizer/plan/planner.c

+13-12
Original file line numberDiff line numberDiff line change
@@ -1918,10 +1918,10 @@ grouping_planner(PlannerInfo *root, double tuple_fraction)
19181918
* whether HAVING succeeds. Furthermore, there cannot be any
19191919
* variables in either HAVING or the targetlist, so we
19201920
* actually do not need the FROM table at all! We can just
1921-
* throw away the plan-so-far and generate a Result node.
1922-
* This is a sufficiently unusual corner case that it's not
1923-
* worth contorting the structure of this routine to avoid
1924-
* having to generate the plan in the first place.
1921+
* throw away the plan-so-far and generate a Result node. This
1922+
* is a sufficiently unusual corner case that it's not worth
1923+
* contorting the structure of this routine to avoid having to
1924+
* generate the plan in the first place.
19251925
*/
19261926
result_plan = (Plan *) make_result(root,
19271927
tlist,
@@ -3157,22 +3157,23 @@ extract_rollup_sets(List *groupingSets)
31573157
if (!lc1)
31583158
return list_make1(groupingSets);
31593159

3160-
/*
3160+
/*----------
31613161
* We don't strictly need to remove duplicate sets here, but if we don't,
31623162
* they tend to become scattered through the result, which is a bit
3163-
* confusing (and irritating if we ever decide to optimize them out). So
3164-
* we remove them here and add them back after.
3163+
* confusing (and irritating if we ever decide to optimize them out).
3164+
* So we remove them here and add them back after.
31653165
*
31663166
* For each non-duplicate set, we fill in the following:
31673167
*
3168-
* orig_sets[i] = list of the original set lists set_masks[i] = bitmapset
3169-
* for testing inclusion adjacency[i] = array [n, v1, v2, ... vn] of
3170-
* adjacency indices
3168+
* orig_sets[i] = list of the original set lists
3169+
* set_masks[i] = bitmapset for testing inclusion
3170+
* adjacency[i] = array [n, v1, v2, ... vn] of adjacency indices
31713171
*
31723172
* chains[i] will be the result group this set is assigned to.
31733173
*
3174-
* We index all of these from 1 rather than 0 because it is convenient to
3175-
* leave 0 free for the NIL node in the graph algorithm.
3174+
* We index all of these from 1 rather than 0 because it is convenient
3175+
* to leave 0 free for the NIL node in the graph algorithm.
3176+
*----------
31763177
*/
31773178
orig_sets = palloc0((num_sets_raw + 1) * sizeof(List *));
31783179
set_masks = palloc0((num_sets_raw + 1) * sizeof(Bitmapset *));

src/backend/rewrite/rowsecurity.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -596,8 +596,8 @@ process_policies(Query *root, List *policies, int rt_index, Expr **qual_eval,
596596
*qual_eval = (Expr *) linitial(quals);
597597

598598
/*
599-
* Similairly, if more than one WITH CHECK qual is returned, then they
600-
* need to be combined together.
599+
* Similarly, if more than one WITH CHECK qual is returned, then they need
600+
* to be combined together.
601601
*
602602
* with_check_quals is allowed to be NIL here since this might not be the
603603
* resultRelation (see above).

src/backend/utils/adt/jsonb.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -584,7 +584,7 @@ add_indent(StringInfo out, bool indent, int level)
584584
*
585585
* Given the datatype OID, return its JsonbTypeCategory, as well as the type's
586586
* output function OID. If the returned category is JSONBTYPE_JSONCAST,
587-
* we return the OID of the relevant cast function instead.
587+
* we return the OID of the relevant cast function instead.
588588
*/
589589
static void
590590
jsonb_categorize_type(Oid typoid,

src/backend/utils/adt/ruleutils.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ typedef struct
106106
int wrapColumn; /* max line length, or -1 for no limit */
107107
int indentLevel; /* current indent level for prettyprint */
108108
bool varprefix; /* TRUE to print prefixes on Vars */
109-
ParseExprKind special_exprkind; /* set only for exprkinds needing */
110-
/* special handling */
109+
ParseExprKind special_exprkind; /* set only for exprkinds needing
110+
* special handling */
111111
} deparse_context;
112112

113113
/*

0 commit comments

Comments
 (0)