summaryrefslogtreecommitdiff
path: root/src/backend/utils/misc/help_config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/utils/misc/help_config.c')
-rw-r--r--src/backend/utils/misc/help_config.c59
1 files changed, 22 insertions, 37 deletions
diff --git a/src/backend/utils/misc/help_config.c b/src/backend/utils/misc/help_config.c
index 86812ac881f..2810715693c 100644
--- a/src/backend/utils/misc/help_config.c
+++ b/src/backend/utils/misc/help_config.c
@@ -23,23 +23,8 @@
#include "utils/help_config.h"
-/*
- * This union allows us to mix the numerous different types of structs
- * that we are organizing.
- */
-typedef union
-{
- struct config_generic generic;
- struct config_bool _bool;
- struct config_real real;
- struct config_int integer;
- struct config_string string;
- struct config_enum _enum;
-} mixedStruct;
-
-
-static void printMixedStruct(mixedStruct *structToPrint);
-static bool displayStruct(mixedStruct *structToDisplay);
+static void printMixedStruct(const struct config_generic *structToPrint);
+static bool displayStruct(const struct config_generic *structToDisplay);
void
@@ -55,7 +40,7 @@ GucInfoMain(void)
for (int i = 0; i < numOpts; i++)
{
- mixedStruct *var = (mixedStruct *) guc_vars[i];
+ const struct config_generic *var = guc_vars[i];
if (displayStruct(var))
printMixedStruct(var);
@@ -70,11 +55,11 @@ GucInfoMain(void)
* should be displayed to the user.
*/
static bool
-displayStruct(mixedStruct *structToDisplay)
+displayStruct(const struct config_generic *structToDisplay)
{
- return !(structToDisplay->generic.flags & (GUC_NO_SHOW_ALL |
- GUC_NOT_IN_SAMPLE |
- GUC_DISALLOW_IN_FILE));
+ return !(structToDisplay->flags & (GUC_NO_SHOW_ALL |
+ GUC_NOT_IN_SAMPLE |
+ GUC_DISALLOW_IN_FILE));
}
@@ -83,14 +68,14 @@ displayStruct(mixedStruct *structToDisplay)
* a different format, depending on what the user wants to see.
*/
static void
-printMixedStruct(mixedStruct *structToPrint)
+printMixedStruct(const struct config_generic *structToPrint)
{
printf("%s\t%s\t%s\t",
- structToPrint->generic.name,
- GucContext_Names[structToPrint->generic.context],
- _(config_group_names[structToPrint->generic.group]));
+ structToPrint->name,
+ GucContext_Names[structToPrint->context],
+ _(config_group_names[structToPrint->group]));
- switch (structToPrint->generic.vartype)
+ switch (structToPrint->vartype)
{
case PGC_BOOL:
@@ -101,26 +86,26 @@ printMixedStruct(mixedStruct *structToPrint)
case PGC_INT:
printf("INTEGER\t%d\t%d\t%d\t",
- structToPrint->integer.reset_val,
- structToPrint->integer.min,
- structToPrint->integer.max);
+ structToPrint->_int.reset_val,
+ structToPrint->_int.min,
+ structToPrint->_int.max);
break;
case PGC_REAL:
printf("REAL\t%g\t%g\t%g\t",
- structToPrint->real.reset_val,
- structToPrint->real.min,
- structToPrint->real.max);
+ structToPrint->_real.reset_val,
+ structToPrint->_real.min,
+ structToPrint->_real.max);
break;
case PGC_STRING:
printf("STRING\t%s\t\t\t",
- structToPrint->string.boot_val ? structToPrint->string.boot_val : "");
+ structToPrint->_string.boot_val ? structToPrint->_string.boot_val : "");
break;
case PGC_ENUM:
printf("ENUM\t%s\t\t\t",
- config_enum_lookup_by_value(&structToPrint->_enum,
+ config_enum_lookup_by_value(structToPrint,
structToPrint->_enum.boot_val));
break;
@@ -130,6 +115,6 @@ printMixedStruct(mixedStruct *structToPrint)
}
printf("%s\t%s\n",
- (structToPrint->generic.short_desc == NULL) ? "" : _(structToPrint->generic.short_desc),
- (structToPrint->generic.long_desc == NULL) ? "" : _(structToPrint->generic.long_desc));
+ (structToPrint->short_desc == NULL) ? "" : _(structToPrint->short_desc),
+ (structToPrint->long_desc == NULL) ? "" : _(structToPrint->long_desc));
}