* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.438 2008/03/16 16:42:44 mha Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.439 2008/03/17 17:45:09 mha Exp $
*
*--------------------------------------------------------------------
*/
static bool assign_autovacuum_max_workers(int newval, bool doit, GucSource source);
static bool assign_maxconnections(int newval, bool doit, GucSource source);
-static const char *config_enum_lookup_value(struct config_enum *record, int val);
-static bool config_enum_lookup_name(struct config_enum *record,
- const char *value, int *retval);
static char *config_enum_get_options(struct config_enum *record,
const char *prefix, const char *suffix);
PGC_S_DEFAULT))
elog(FATAL, "failed to initialize %s to %s",
conf->gen.name,
- config_enum_lookup_value(conf, conf->boot_val));
+ config_enum_lookup_by_value(conf, conf->boot_val));
*conf->variable = conf->reset_val = conf->boot_val;
break;
}
* The returned string is a pointer to static data and not
* allocated for modification.
*/
-static const char *
-config_enum_lookup_value(struct config_enum *record, int val)
+const char *
+config_enum_lookup_by_value(struct config_enum *record, int val)
{
const struct config_enum_entry *entry = record->options;
while (entry && entry->name)
* true. If it's not found, return FALSE and retval is set to 0.
*
*/
-static bool
-config_enum_lookup_name(struct config_enum *record, const char *value, int *retval)
+bool
+config_enum_lookup_by_name(struct config_enum *record, const char *value, int *retval)
{
const struct config_enum_entry *entry = record->options;
if (value)
{
- if (!config_enum_lookup_name(conf, value, &newval))
+ if (!config_enum_lookup_by_name(conf, value, &newval))
{
char *hintmsg = config_enum_get_options(conf, "Available values: ", ".");
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
errmsg("invalid value for parameter \"%s\": \"%s\"",
name,
- config_enum_lookup_value(conf, newval))));
+ config_enum_lookup_by_value(conf, newval))));
return false;
}
return *((struct config_string *) record)->variable;
case PGC_ENUM:
- return config_enum_lookup_value((struct config_enum *) record,
+ return config_enum_lookup_by_value((struct config_enum *) record,
*((struct config_enum *) record)->variable);
}
return NULL;
return ((struct config_string *) record)->reset_val;
case PGC_ENUM:
- return config_enum_lookup_value((struct config_enum *) record,
+ return config_enum_lookup_by_value((struct config_enum *) record,
((struct config_enum *) record)->reset_val);
}
return NULL;
if(conf->show_hook)
val = (*conf->show_hook) ();
else
- val = config_enum_lookup_value(conf, *conf->variable);
+ val = config_enum_lookup_by_value(conf, *conf->variable);
}
break;
struct config_enum *conf = (struct config_enum *) record;
int newval;
- return config_enum_lookup_name(conf, newvalue, &newval)
+ return config_enum_lookup_by_name(conf, newvalue, &newval)
&& *conf->variable == newval;
}
}
{
struct config_enum *conf = (struct config_enum *) gconf;
- fprintf(fp, "%s", config_enum_lookup_value(conf, *conf->variable));
+ fprintf(fp, "%s", config_enum_lookup_by_value(conf, *conf->variable));
}
break;
}
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/utils/misc/help_config.c,v 1.20 2008/02/23 19:23:33 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/utils/misc/help_config.c,v 1.21 2008/03/17 17:45:09 mha Exp $
*
*-------------------------------------------------------------------------
*/
struct config_real real;
struct config_int integer;
struct config_string string;
+ struct config_enum _enum;
} mixedStruct;
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,
+ structToPrint->_enum.boot_val));
+ break;
+
default:
write_stderr("internal error: unrecognized run-time parameter type\n");
break;