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

Commit2bdc51a

Browse files
committed
Run the C portions of guc-file.l through pgindent.
Yeah, I know, pretty anal-retentive of me. But we oughta find someway to automate this for the .y and .l files.
1 parent62d16c7 commit2bdc51a

File tree

1 file changed

+54
-52
lines changed

1 file changed

+54
-52
lines changed

‎src/backend/utils/misc/guc-file.l

Lines changed: 54 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@
2929
#undef fprintf
3030
#definefprintf(file, fmt, msg) GUC_flex_fatal(msg)
3131

32-
enum {
32+
enum
33+
{
3334
GUC_ID =1,
3435
GUC_STRING =2,
3536
GUC_INTEGER =3,
@@ -53,7 +54,7 @@ static void record_config_file_error(const char *errmsg,
5354
ConfigVariable **head_p,
5455
ConfigVariable **tail_p);
5556

56-
staticintGUC_flex_fatal(constchar *msg);
57+
staticintGUC_flex_fatal(constchar *msg);
5758
staticchar *GUC_scanstr(constchar *s);
5859

5960
%}
@@ -124,15 +125,15 @@ ProcessConfigFile(GucContext context)
124125
MemoryContext caller_cxt;
125126
126127
/*
127-
* Config files are processed on startup (by the postmaster only)
128-
*and onSIGHUP (by the postmaster and its children)
128+
* Config files are processed on startup (by the postmaster only) and on
129+
* SIGHUP (by the postmaster and its children)
129130
*/
130131
Assert((context == PGC_POSTMASTER && !IsUnderPostmaster) ||
131132
context == PGC_SIGHUP);
132133
133134
/*
134-
* To avoid cluttering the log, only the postmaster bleats loudly
135-
*aboutproblems with the config file.
135+
* To avoid cluttering the log, only the postmaster bleats loudly about
136+
* problems with the config file.
136137
*/
137138
elevel = IsUnderPostmaster ? DEBUG2 : LOG;
138139
@@ -191,10 +192,10 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
191192
}
192193

193194
/*
194-
* Parse the PG_AUTOCONF_FILENAME file, if present, after the main file
195-
*toreplace any parameters set by ALTER SYSTEM command. Because this
196-
*fileis in the data directory, we can't read it until the DataDir has
197-
*beenset.
195+
* Parse the PG_AUTOCONF_FILENAME file, if present, after the main file to
196+
* replace any parameters set by ALTER SYSTEM command. Because this file
197+
* is in the data directory, we can't read it until the DataDir has been
198+
* set.
198199
*/
199200
if (DataDir)
200201
{
@@ -246,9 +247,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
246247
}
247248

248249
/*
249-
* Mark all extant GUC variables as not present in the config file.
250-
*Weneed this so that we can tell below which ones have been removed
251-
*fromthe file since we last processed it.
250+
* Mark all extant GUC variables as not present in the config file. We
251+
* need this so that we can tell below which ones have been removed from
252+
* the file since we last processed it.
252253
*/
253254
for (i =0; i < num_guc_variables; i++)
254255
{
@@ -260,15 +261,15 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
260261
/*
261262
* Check if all the supplied option names are valid, as an additional
262263
* quasi-syntactic check on the validity of the config file. It is
263-
* important that the postmaster and all backends agree on the results
264-
*ofthis phase, else we will have strange inconsistencies about which
264+
* important that the postmaster and all backends agree on the results of
265+
* this phase, else we will have strange inconsistencies about which
265266
* processes accept a config file update and which don't. Hence, unknown
266267
* custom variable names have to be accepted without complaint. For the
267268
* same reason, we don't attempt to validate the options' values here.
268269
*
269270
* In addition, the GUC_IS_IN_FILE flag is set on each existing GUC
270-
* variable mentioned in the file; and we detect duplicate entries in
271-
*thefile and mark the earlier occurrences as ignorable.
271+
* variable mentioned in the file; and we detect duplicate entries in the
272+
* file and mark the earlier occurrences as ignorable.
272273
*/
273274
for (item = head; item; item = item->next)
274275
{
@@ -279,8 +280,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
279280
continue;
280281

281282
/*
282-
* Try to find the variable; but do not create a custom placeholder
283-
*ifit's not there already.
283+
* Try to find the variable; but do not create a custom placeholder if
284+
* it's not there already.
284285
*/
285286
record =find_option(item->name,false, elevel);
286287

@@ -321,8 +322,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
321322
}
322323

323324
/*
324-
* If we've detected any errors so far, we don't want to risk applying
325-
*anychanges.
325+
* If we've detected any errors so far, we don't want to risk applying any
326+
* changes.
326327
*/
327328
if (error)
328329
goto bail_out;
@@ -363,8 +364,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
363364
continue;
364365

365366
/*
366-
* Reset any "file" sources to "default", else set_config_option
367-
*willnot override those settings.
367+
* Reset any "file" sources to "default", else set_config_option will
368+
* not override those settings.
368369
*/
369370
if (gconf->reset_source == PGC_S_FILE)
370371
gconf->reset_source = PGC_S_DEFAULT;
@@ -394,14 +395,14 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
394395
* dynamically-computed defaults. This is a no-op except in the case
395396
* where one of these had been in the config file and is now removed.
396397
*
397-
* In particular, we *must not* do this during the postmaster's
398-
*initialloading of the file, since the timezone functions in
399-
*particular shouldbe run only after initialization is complete.
398+
* In particular, we *must not* do this during the postmaster's initial
399+
* loading of the file, since the timezone functions in particular should
400+
* be run only after initialization is complete.
400401
*
401-
* XXX this is an unmaintainable crock, because we have to know how
402-
*to set(or at least what to call to set) every variable that could
403-
*potentiallyhave PGC_S_DYNAMIC_DEFAULT or PGC_S_ENV_VAR source.
404-
*However, there's notime to redesign it for 9.1.
402+
* XXX this is an unmaintainable crock, because we have to know how to set
403+
* (or at least what to call to set) every variable that could potentially
404+
* have PGC_S_DYNAMIC_DEFAULT or PGC_S_ENV_VAR source. However, there's no
405+
* time to redesign it for 9.1.
405406
*/
406407
if (context == PGC_SIGHUP && applySettings)
407408
{
@@ -417,8 +418,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
417418
*/
418419
for (item = head; item; item = item->next)
419420
{
420-
char *pre_value =NULL;
421-
intscres;
421+
char *pre_value =NULL;
422+
intscres;
422423

423424
/* Ignore anything marked as ignorable */
424425
if (item->ignore)
@@ -485,7 +486,7 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
485486
if (applySettings)
486487
PgReloadTime =GetCurrentTimestamp();
487488

488-
bail_out:
489+
bail_out:
489490
if (error && applySettings)
490491
{
491492
/* During postmaster startup, any error is fatal */
@@ -567,9 +568,9 @@ ParseConfigFile(const char *config_file, bool strict,
567568
FILE *fp;
568569

569570
/*
570-
* Reject too-deep include nesting depth. This is just a safety check
571-
*toavoid dumping core due to stack overflow if an include file loops
572-
*backto itself. The maximum nesting depth is pretty arbitrary.
571+
* Reject too-deep include nesting depth. This is just a safety check to
572+
* avoid dumping core due to stack overflow if an include file loops back
573+
* to itself. The maximum nesting depth is pretty arbitrary.
573574
*/
574575
if (depth >10)
575576
{
@@ -660,7 +661,7 @@ GUC_flex_fatal(const char *msg)
660661
{
661662
GUC_flex_fatal_errmsg = msg;
662663
siglongjmp(*GUC_flex_fatal_jmp,1);
663-
return0;/* keep compiler quiet */
664+
return0;/* keep compiler quiet */
664665
}
665666

666667
/*
@@ -828,7 +829,7 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
828829
item->value = opt_value;
829830
item->errmsg =NULL;
830831
item->filename =pstrdup(config_file);
831-
item->sourceline = ConfigFileLineno-1;
832+
item->sourceline = ConfigFileLineno -1;
832833
item->ignore =false;
833834
item->applied =false;
834835
item->next =NULL;
@@ -844,7 +845,7 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
844845
break;
845846
continue;
846847

847-
parse_error:
848+
parse_error:
848849
/* release storage if we allocated any on this line */
849850
if (opt_name)
850851
pfree(opt_name);
@@ -856,8 +857,8 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
856857
{
857858
ereport(elevel,
858859
(errcode(ERRCODE_SYNTAX_ERROR),
859-
errmsg("syntax error in file\"%s\" line %u, near end of line",
860-
config_file, ConfigFileLineno -1)));
860+
errmsg("syntax error in file\"%s\" line %u, near end of line",
861+
config_file, ConfigFileLineno -1)));
861862
record_config_file_error("syntax error",
862863
config_file, ConfigFileLineno -1,
863864
head_p, tail_p);
@@ -866,8 +867,8 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
866867
{
867868
ereport(elevel,
868869
(errcode(ERRCODE_SYNTAX_ERROR),
869-
errmsg("syntax error in file\"%s\" line %u, near token\"%s\"",
870-
config_file, ConfigFileLineno, yytext)));
870+
errmsg("syntax error in file\"%s\" line %u, near token\"%s\"",
871+
config_file, ConfigFileLineno, yytext)));
871872
record_config_file_error("syntax error",
872873
config_file, ConfigFileLineno,
873874
head_p, tail_p);
@@ -878,16 +879,16 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
878879
/*
879880
* To avoid producing too much noise when fed a totally bogus file,
880881
* give up after 100 syntax errors per file (an arbitrary number).
881-
* Also, if we're only logging the errors at DEBUG level anyway,
882-
*mightas well give up immediately. (This prevents postmaster
883-
*childrenfrom bloating the logs with duplicate complaints.)
882+
* Also, if we're only logging the errors at DEBUG level anyway, might
883+
* as well give up immediately. (This prevents postmaster children
884+
* from bloating the logs with duplicate complaints.)
884885
*/
885886
if (errorcount >=100 || elevel <= DEBUG1)
886887
{
887888
ereport(elevel,
888889
(errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED),
889-
errmsg("too many syntax errors found, abandoning file\"%s\"",
890-
config_file)));
890+
errmsg("too many syntax errors found, abandoning file\"%s\"",
891+
config_file)));
891892
break;
892893
}
893894

@@ -959,7 +960,7 @@ ParseConfigDirectory(const char *includedir,
959960
while ((de =ReadDir(d, directory)) !=NULL)
960961
{
961962
structstat st;
962-
charfilename[MAXPGPATH];
963+
charfilename[MAXPGPATH];
963964

964965
/*
965966
* Only parse files with names ending in ".conf". Explicitly reject
@@ -984,7 +985,7 @@ ParseConfigDirectory(const char *includedir,
984985
{
985986
size_filenames +=32;
986987
filenames = (char **)repalloc(filenames,
987-
size_filenames *sizeof(char *));
988+
size_filenames *sizeof(char *));
988989
}
989990
filenames[num_filenames] =pstrdup(filename);
990991
num_filenames++;
@@ -1013,6 +1014,7 @@ ParseConfigDirectory(const char *includedir,
10131014
if (num_filenames >0)
10141015
{
10151016
inti;
1017+
10161018
qsort(filenames, num_filenames,sizeof(char *), pg_qsort_strcmp);
10171019
for (i =0; i < num_filenames; i++)
10181020
{
@@ -1091,7 +1093,7 @@ GUC_scanstr(const char *s)
10911093
Assert(s !=NULL && s[0] =='\'');
10921094
len =strlen(s);
10931095
Assert(len >=2);
1094-
Assert(s[len-1] =='\'');
1096+
Assert(s[len -1] =='\'');
10951097

10961098
/* Skip the leading quote; we'll handle the trailing quote below */
10971099
s++, len--;
@@ -1146,7 +1148,7 @@ GUC_scanstr(const char *s)
11461148
break;
11471149
}/* switch */
11481150
}
1149-
elseif (s[i] =='\'' && s[i+1] =='\'')
1151+
elseif (s[i] =='\'' && s[i +1] =='\'')
11501152
{
11511153
/* doubled quote becomes just one quote */
11521154
newStr[j] = s[++i];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp