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;
}