mirror of
https://github.com/postgres/postgres.git
synced 2025-05-22 00:02:02 -04:00
Run the C portions of guc-file.l through pgindent.
Yeah, I know, pretty anal-retentive of me. But we oughta find some way to automate this for the .y and .l files.
This commit is contained in:
parent
62d16c7fc5
commit
2bdc51a294
@ -29,7 +29,8 @@
|
|||||||
#undef fprintf
|
#undef fprintf
|
||||||
#define fprintf(file, fmt, msg) GUC_flex_fatal(msg)
|
#define fprintf(file, fmt, msg) GUC_flex_fatal(msg)
|
||||||
|
|
||||||
enum {
|
enum
|
||||||
|
{
|
||||||
GUC_ID = 1,
|
GUC_ID = 1,
|
||||||
GUC_STRING = 2,
|
GUC_STRING = 2,
|
||||||
GUC_INTEGER = 3,
|
GUC_INTEGER = 3,
|
||||||
@ -124,15 +125,15 @@ ProcessConfigFile(GucContext context)
|
|||||||
MemoryContext caller_cxt;
|
MemoryContext caller_cxt;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Config files are processed on startup (by the postmaster only)
|
* Config files are processed on startup (by the postmaster only) and on
|
||||||
* and on SIGHUP (by the postmaster and its children)
|
* SIGHUP (by the postmaster and its children)
|
||||||
*/
|
*/
|
||||||
Assert((context == PGC_POSTMASTER && !IsUnderPostmaster) ||
|
Assert((context == PGC_POSTMASTER && !IsUnderPostmaster) ||
|
||||||
context == PGC_SIGHUP);
|
context == PGC_SIGHUP);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* To avoid cluttering the log, only the postmaster bleats loudly
|
* To avoid cluttering the log, only the postmaster bleats loudly about
|
||||||
* about problems with the config file.
|
* problems with the config file.
|
||||||
*/
|
*/
|
||||||
elevel = IsUnderPostmaster ? DEBUG2 : LOG;
|
elevel = IsUnderPostmaster ? DEBUG2 : LOG;
|
||||||
|
|
||||||
@ -191,10 +192,10 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse the PG_AUTOCONF_FILENAME file, if present, after the main file
|
* Parse the PG_AUTOCONF_FILENAME file, if present, after the main file to
|
||||||
* to replace any parameters set by ALTER SYSTEM command. Because this
|
* replace any parameters set by ALTER SYSTEM command. Because this file
|
||||||
* file is in the data directory, we can't read it until the DataDir has
|
* is in the data directory, we can't read it until the DataDir has been
|
||||||
* been set.
|
* set.
|
||||||
*/
|
*/
|
||||||
if (DataDir)
|
if (DataDir)
|
||||||
{
|
{
|
||||||
@ -246,9 +247,9 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Mark all extant GUC variables as not present in the config file.
|
* Mark all extant GUC variables as not present in the config file. We
|
||||||
* We need this so that we can tell below which ones have been removed
|
* need this so that we can tell below which ones have been removed from
|
||||||
* from the file since we last processed it.
|
* the file since we last processed it.
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < num_guc_variables; i++)
|
for (i = 0; i < num_guc_variables; i++)
|
||||||
{
|
{
|
||||||
@ -260,15 +261,15 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
/*
|
/*
|
||||||
* Check if all the supplied option names are valid, as an additional
|
* Check if all the supplied option names are valid, as an additional
|
||||||
* quasi-syntactic check on the validity of the config file. It is
|
* quasi-syntactic check on the validity of the config file. It is
|
||||||
* important that the postmaster and all backends agree on the results
|
* important that the postmaster and all backends agree on the results of
|
||||||
* of this phase, else we will have strange inconsistencies about which
|
* this phase, else we will have strange inconsistencies about which
|
||||||
* processes accept a config file update and which don't. Hence, unknown
|
* processes accept a config file update and which don't. Hence, unknown
|
||||||
* custom variable names have to be accepted without complaint. For the
|
* custom variable names have to be accepted without complaint. For the
|
||||||
* same reason, we don't attempt to validate the options' values here.
|
* same reason, we don't attempt to validate the options' values here.
|
||||||
*
|
*
|
||||||
* In addition, the GUC_IS_IN_FILE flag is set on each existing GUC
|
* In addition, the GUC_IS_IN_FILE flag is set on each existing GUC
|
||||||
* variable mentioned in the file; and we detect duplicate entries in
|
* variable mentioned in the file; and we detect duplicate entries in the
|
||||||
* the file and mark the earlier occurrences as ignorable.
|
* file and mark the earlier occurrences as ignorable.
|
||||||
*/
|
*/
|
||||||
for (item = head; item; item = item->next)
|
for (item = head; item; item = item->next)
|
||||||
{
|
{
|
||||||
@ -279,8 +280,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to find the variable; but do not create a custom placeholder
|
* Try to find the variable; but do not create a custom placeholder if
|
||||||
* if it's not there already.
|
* it's not there already.
|
||||||
*/
|
*/
|
||||||
record = find_option(item->name, false, elevel);
|
record = find_option(item->name, false, elevel);
|
||||||
|
|
||||||
@ -321,8 +322,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we've detected any errors so far, we don't want to risk applying
|
* If we've detected any errors so far, we don't want to risk applying any
|
||||||
* any changes.
|
* changes.
|
||||||
*/
|
*/
|
||||||
if (error)
|
if (error)
|
||||||
goto bail_out;
|
goto bail_out;
|
||||||
@ -363,8 +364,8 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reset any "file" sources to "default", else set_config_option
|
* Reset any "file" sources to "default", else set_config_option will
|
||||||
* will not override those settings.
|
* not override those settings.
|
||||||
*/
|
*/
|
||||||
if (gconf->reset_source == PGC_S_FILE)
|
if (gconf->reset_source == PGC_S_FILE)
|
||||||
gconf->reset_source = PGC_S_DEFAULT;
|
gconf->reset_source = PGC_S_DEFAULT;
|
||||||
@ -394,14 +395,14 @@ ProcessConfigFileInternal(GucContext context, bool applySettings, int elevel)
|
|||||||
* dynamically-computed defaults. This is a no-op except in the case
|
* dynamically-computed defaults. This is a no-op except in the case
|
||||||
* where one of these had been in the config file and is now removed.
|
* where one of these had been in the config file and is now removed.
|
||||||
*
|
*
|
||||||
* In particular, we *must not* do this during the postmaster's
|
* In particular, we *must not* do this during the postmaster's initial
|
||||||
* initial loading of the file, since the timezone functions in
|
* loading of the file, since the timezone functions in particular should
|
||||||
* particular should be run only after initialization is complete.
|
* be run only after initialization is complete.
|
||||||
*
|
*
|
||||||
* XXX this is an unmaintainable crock, because we have to know how
|
* XXX this is an unmaintainable crock, because we have to know how to set
|
||||||
* to set (or at least what to call to set) every variable that could
|
* (or at least what to call to set) every variable that could potentially
|
||||||
* potentially have PGC_S_DYNAMIC_DEFAULT or PGC_S_ENV_VAR source.
|
* have PGC_S_DYNAMIC_DEFAULT or PGC_S_ENV_VAR source. However, there's no
|
||||||
* However, there's no time to redesign it for 9.1.
|
* time to redesign it for 9.1.
|
||||||
*/
|
*/
|
||||||
if (context == PGC_SIGHUP && applySettings)
|
if (context == PGC_SIGHUP && applySettings)
|
||||||
{
|
{
|
||||||
@ -567,9 +568,9 @@ ParseConfigFile(const char *config_file, bool strict,
|
|||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Reject too-deep include nesting depth. This is just a safety check
|
* Reject too-deep include nesting depth. This is just a safety check to
|
||||||
* to avoid dumping core due to stack overflow if an include file loops
|
* avoid dumping core due to stack overflow if an include file loops back
|
||||||
* back to itself. The maximum nesting depth is pretty arbitrary.
|
* to itself. The maximum nesting depth is pretty arbitrary.
|
||||||
*/
|
*/
|
||||||
if (depth > 10)
|
if (depth > 10)
|
||||||
{
|
{
|
||||||
@ -878,9 +879,9 @@ ParseConfigFp(FILE *fp, const char *config_file, int depth, int elevel,
|
|||||||
/*
|
/*
|
||||||
* To avoid producing too much noise when fed a totally bogus file,
|
* To avoid producing too much noise when fed a totally bogus file,
|
||||||
* give up after 100 syntax errors per file (an arbitrary number).
|
* give up after 100 syntax errors per file (an arbitrary number).
|
||||||
* Also, if we're only logging the errors at DEBUG level anyway,
|
* Also, if we're only logging the errors at DEBUG level anyway, might
|
||||||
* might as well give up immediately. (This prevents postmaster
|
* as well give up immediately. (This prevents postmaster children
|
||||||
* children from bloating the logs with duplicate complaints.)
|
* from bloating the logs with duplicate complaints.)
|
||||||
*/
|
*/
|
||||||
if (errorcount >= 100 || elevel <= DEBUG1)
|
if (errorcount >= 100 || elevel <= DEBUG1)
|
||||||
{
|
{
|
||||||
@ -1013,6 +1014,7 @@ ParseConfigDirectory(const char *includedir,
|
|||||||
if (num_filenames > 0)
|
if (num_filenames > 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
qsort(filenames, num_filenames, sizeof(char *), pg_qsort_strcmp);
|
qsort(filenames, num_filenames, sizeof(char *), pg_qsort_strcmp);
|
||||||
for (i = 0; i < num_filenames; i++)
|
for (i = 0; i < num_filenames; i++)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user