summaryrefslogtreecommitdiff
path: root/main/sorcery.c
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2016-06-20 13:21:52 -0500
committerMark Michelson <mmichelson@digium.com>2016-06-22 12:23:44 -0500
commitb6bd97eea2ddeba2b0ea2380da29fba98b8a3208 (patch)
treeafc7f87a63ce0e80385356fd381d6d945b29fcde /main/sorcery.c
parent11caa10cf5abae8abef91a887c30e81e8d38486a (diff)
Fix Alembic upgrades.
A non-existent constraint was being referenced in the upgrade script. This patch corrects the problem by removing the reference. In addition, the head of the alembic branch referred to a non-existent revision. This has been fixed by referring to the proper revision. This patch fixes another realtime problem as well. Our Alembic scripts store booleans as yes or no values. However, Sorcery tries to insert "true" or "false" instead. This patch introduces a new boolean type that translates to "yes" or "no" instead. ASTERISK-26128 #close Change-Id: I51574736a881189de695a824883a18d66a52dcef
Diffstat (limited to 'main/sorcery.c')
-rw-r--r--main/sorcery.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/main/sorcery.c b/main/sorcery.c
index 6a7b54bbf..a739f5eb8 100644
--- a/main/sorcery.c
+++ b/main/sorcery.c
@@ -293,6 +293,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]);
@@ -316,6 +322,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;