mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-11 13:43:47 +01:00
Replace config_find_option with a variant that exposes less
This commit is contained in:
parent
769fe81717
commit
7e91d4f572
@ -2588,8 +2588,7 @@ config_parse_commandline(int argc, char **argv, int ignore_errors,
|
|||||||
int
|
int
|
||||||
option_is_recognized(const char *key)
|
option_is_recognized(const char *key)
|
||||||
{
|
{
|
||||||
const config_var_t *var = config_find_option(get_options_mgr(), key);
|
return config_find_option_name(get_options_mgr(), key) != NULL;
|
||||||
return (var != NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the canonical name of a configuration option, or NULL
|
/** Return the canonical name of a configuration option, or NULL
|
||||||
@ -2597,8 +2596,7 @@ option_is_recognized(const char *key)
|
|||||||
const char *
|
const char *
|
||||||
option_get_canonical_name(const char *key)
|
option_get_canonical_name(const char *key)
|
||||||
{
|
{
|
||||||
const config_var_t *var = config_find_option(get_options_mgr(), key);
|
return config_find_option_name(get_options_mgr(), key);
|
||||||
return var ? var->member.name : NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return a canonical list of the options assigned for key.
|
/** Return a canonical list of the options assigned for key.
|
||||||
|
@ -288,17 +288,17 @@ config_mgr_find_var(const config_mgr_t *mgr,
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** If <b>key</b> is a configuration option, return the corresponding const
|
/**
|
||||||
* config_var_t. Otherwise, if <b>key</b> is a non-standard abbreviation,
|
* If <b>key</b> is a name or an abbreviation configuration option, return
|
||||||
* warn, and return the corresponding const config_var_t. Otherwise return
|
* the corresponding canonical name for it. Warn if the abbreviation is
|
||||||
* NULL.
|
* non-standard. Return NULL if the option does not exist.
|
||||||
*/
|
*/
|
||||||
const config_var_t *
|
const char *
|
||||||
config_find_option(const config_mgr_t *mgr, const char *key)
|
config_find_option_name(const config_mgr_t *mgr, const char *key)
|
||||||
{
|
{
|
||||||
const managed_var_t *mv = config_mgr_find_var(mgr, key, true, NULL);
|
const managed_var_t *mv = config_mgr_find_var(mgr, key, true, NULL);
|
||||||
if (mv)
|
if (mv)
|
||||||
return mv->cvar;
|
return mv->cvar->member.name;
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -112,7 +112,7 @@ int config_assign(const config_mgr_t *mgr, void *options,
|
|||||||
unsigned flags, char **msg);
|
unsigned flags, char **msg);
|
||||||
const char *config_find_deprecation(const config_mgr_t *mgr,
|
const char *config_find_deprecation(const config_mgr_t *mgr,
|
||||||
const char *key);
|
const char *key);
|
||||||
const config_var_t *config_find_option(const config_mgr_t *mgr,
|
const char *config_find_option_name(const config_mgr_t *mgr,
|
||||||
const char *key);
|
const char *key);
|
||||||
const char *config_expand_abbrev(const config_mgr_t *mgr,
|
const char *config_expand_abbrev(const config_mgr_t *mgr,
|
||||||
const char *option,
|
const char *option,
|
||||||
|
Loading…
Reference in New Issue
Block a user