diff options
author | zuul <zuul@gerrit.asterisk.org> | 2016-06-22 15:22:44 -0500 |
---|---|---|
committer | Gerrit Code Review <gerrit2@gerrit.digium.api> | 2016-06-22 15:22:44 -0500 |
commit | 43612a84c828737a53cbc33dec135f881df95125 (patch) | |
tree | f6b67dad46b943bda92c002dd324da8eebe33055 /main | |
parent | 08a4699367cfad68c8ccefe28001ee1b8bef67da (diff) | |
parent | 1b79e2deff58dbf3f98791da1715aa4a696b028c (diff) |
Merge "Fix Alembic upgrades." into 13
Diffstat (limited to 'main')
-rw-r--r-- | main/config_options.c | 5 | ||||
-rw-r--r-- | main/sorcery.c | 7 |
2 files changed, 12 insertions, 0 deletions
diff --git a/main/config_options.c b/main/config_options.c index c8988c984..cc8e218f8 100644 --- a/main/config_options.c +++ b/main/config_options.c @@ -97,6 +97,7 @@ static char *aco_option_type_string[] = { "IP Address", /* OPT_SOCKADDR_T, */ "String", /* OPT_STRINGFIELD_T, */ "Unsigned Integer", /* OPT_UINT_T, */ + "Boolean", /* OPT_YESNO_T, */ }; void *aco_pending_config(struct aco_info *info) @@ -139,6 +140,10 @@ static aco_option_handler ast_config_option_default_handler(enum aco_option_type switch(type) { case OPT_ACL_T: return acl_handler_fn; case OPT_BOOL_T: return bool_handler_fn; + /* Reading from config files, BOOL and YESNO are handled exactly the + * same. Their difference is in how they are rendered to users + */ + case OPT_YESNO_T: return bool_handler_fn; case OPT_BOOLFLAG_T: return boolflag_handler_fn; case OPT_CHAR_ARRAY_T: return chararray_handler_fn; case OPT_CODEC_T: return codec_handler_fn; diff --git a/main/sorcery.c b/main/sorcery.c index 4dedc4d9b..bfc768879 100644 --- a/main/sorcery.c +++ b/main/sorcery.c @@ -290,6 +290,12 @@ static int bool_handler_fn(const void *obj, const intptr_t *args, char **buf) return !(*buf = ast_strdup(*field ? "true" : "false")) ? -1 : 0; } +static int yesno_handler_fn(const void *obj, const intptr_t *args, char **buf) +{ + unsigned int *field = (unsigned int *)(obj + args[0]); + return !(*buf = ast_strdup(*field ? "yes" : "no")) ? -1 : 0; +} + static int sockaddr_handler_fn(const void *obj, const intptr_t *args, char **buf) { struct ast_sockaddr *field = (struct ast_sockaddr *)(obj + args[0]); @@ -313,6 +319,7 @@ static sorcery_field_handler sorcery_field_default_handler(enum aco_option_type { switch(type) { case OPT_BOOL_T: return bool_handler_fn; + case OPT_YESNO_T: return yesno_handler_fn; case OPT_CHAR_ARRAY_T: return chararray_handler_fn; case OPT_CODEC_T: return codec_handler_fn; case OPT_DOUBLE_T: return double_handler_fn; |