mirror of
https://github.com/postgres/postgres.git
synced 2025-10-19 15:49:24 +03:00
Change config_generic.vartype to be initialized at compile time
Previously, this was initialized at run time so that it did not have to be maintained by hand in guc_tables.c. But since that table is now generated anyway, we might as well generate this bit as well. Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://www.postgresql.org/message-id/flat/8fdfb91e-60fb-44fa-8df6-f5dea47353c9@eisentraut.org
This commit is contained in:
@@ -68,6 +68,7 @@ sub print_one_table
|
|||||||
if $entry->{long_desc};
|
if $entry->{long_desc};
|
||||||
printf $ofh "\t\t\t.flags = %s,\n", $entry->{flags}
|
printf $ofh "\t\t\t.flags = %s,\n", $entry->{flags}
|
||||||
if $entry->{flags};
|
if $entry->{flags};
|
||||||
|
printf $ofh "\t\t\t.vartype = %s,\n", ('PGC_' . uc($type));
|
||||||
print $ofh "\t\t},\n";
|
print $ofh "\t\t},\n";
|
||||||
printf $ofh "\t\t.variable = &%s,\n", $entry->{variable};
|
printf $ofh "\t\t.variable = &%s,\n", $entry->{variable};
|
||||||
printf $ofh "\t\t.boot_val = %s,\n", $entry->{boot_val};
|
printf $ofh "\t\t.boot_val = %s,\n", $entry->{boot_val};
|
||||||
|
@@ -890,48 +890,22 @@ build_guc_variables(void)
|
|||||||
ALLOCSET_DEFAULT_SIZES);
|
ALLOCSET_DEFAULT_SIZES);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count all the built-in variables, and set their vartypes correctly.
|
* Count all the built-in variables.
|
||||||
*/
|
*/
|
||||||
for (int i = 0; ConfigureNamesBool[i].gen.name; i++)
|
for (int i = 0; ConfigureNamesBool[i].gen.name; i++)
|
||||||
{
|
|
||||||
struct config_bool *conf = &ConfigureNamesBool[i];
|
|
||||||
|
|
||||||
/* Rather than requiring vartype to be filled in by hand, do this: */
|
|
||||||
conf->gen.vartype = PGC_BOOL;
|
|
||||||
num_vars++;
|
num_vars++;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; ConfigureNamesInt[i].gen.name; i++)
|
for (int i = 0; ConfigureNamesInt[i].gen.name; i++)
|
||||||
{
|
|
||||||
struct config_int *conf = &ConfigureNamesInt[i];
|
|
||||||
|
|
||||||
conf->gen.vartype = PGC_INT;
|
|
||||||
num_vars++;
|
num_vars++;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; ConfigureNamesReal[i].gen.name; i++)
|
for (int i = 0; ConfigureNamesReal[i].gen.name; i++)
|
||||||
{
|
|
||||||
struct config_real *conf = &ConfigureNamesReal[i];
|
|
||||||
|
|
||||||
conf->gen.vartype = PGC_REAL;
|
|
||||||
num_vars++;
|
num_vars++;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; ConfigureNamesString[i].gen.name; i++)
|
for (int i = 0; ConfigureNamesString[i].gen.name; i++)
|
||||||
{
|
|
||||||
struct config_string *conf = &ConfigureNamesString[i];
|
|
||||||
|
|
||||||
conf->gen.vartype = PGC_STRING;
|
|
||||||
num_vars++;
|
num_vars++;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; ConfigureNamesEnum[i].gen.name; i++)
|
for (int i = 0; ConfigureNamesEnum[i].gen.name; i++)
|
||||||
{
|
|
||||||
struct config_enum *conf = &ConfigureNamesEnum[i];
|
|
||||||
|
|
||||||
conf->gen.vartype = PGC_ENUM;
|
|
||||||
num_vars++;
|
num_vars++;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Create hash table with 20% slack
|
* Create hash table with 20% slack
|
||||||
|
@@ -177,8 +177,8 @@ struct config_generic
|
|||||||
const char *short_desc; /* short desc. of this variable's purpose */
|
const char *short_desc; /* short desc. of this variable's purpose */
|
||||||
const char *long_desc; /* long desc. of this variable's purpose */
|
const char *long_desc; /* long desc. of this variable's purpose */
|
||||||
int flags; /* flag bits, see guc.h */
|
int flags; /* flag bits, see guc.h */
|
||||||
|
enum config_type vartype; /* type of variable */
|
||||||
/* variable fields, initialized at runtime: */
|
/* variable fields, initialized at runtime: */
|
||||||
enum config_type vartype; /* type of variable (set only at startup) */
|
|
||||||
int status; /* status bits, see below */
|
int status; /* status bits, see below */
|
||||||
GucSource source; /* source of the current actual value */
|
GucSource source; /* source of the current actual value */
|
||||||
GucSource reset_source; /* source of the reset_value */
|
GucSource reset_source; /* source of the reset_value */
|
||||||
|
Reference in New Issue
Block a user