[svn-commits] mjordan: trunk r381567 - in /trunk: include/asterisk/ main/

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Feb 15 12:44:28 CST 2013


Author: mjordan
Date: Fri Feb 15 12:44:24 2013
New Revision: 381567

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=381567
Log:
Disable strict XML documentation config checking; fix crash caused by sorcery

This patch does two things:
 1. It disables (temporarily) strict XML documentation checking for module
    configurations. We should re-enable it before making any release from
    trunk.
 2. Pass the module flag AST_MODULE through sorcery. This means several of the
    API calls are now macros and will do this automatically for you. The config
    framework needs the module that objects are registering to so it can
    properly construct the documentation. (This was already a required field,
    but sorcery was getting by without it)



Modified:
    trunk/include/asterisk/sorcery.h
    trunk/main/config_options.c
    trunk/main/sorcery.c

Modified: trunk/include/asterisk/sorcery.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/sorcery.h?view=diff&rev=381567&r1=381566&r2=381567
==============================================================================
--- trunk/include/asterisk/sorcery.h (original)
+++ trunk/include/asterisk/sorcery.h Fri Feb 15 12:44:24 2013
@@ -275,17 +275,22 @@
  *
  * \param sorcery Pointer to a sorcery structure
  * \param name Name of the category to use within the configuration file, normally the module name
- *
- * \retval 0 success
- * \retval -1 failure
- */
-int ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name);
+ * \param module The module name (AST_MODULE)
+ *
+ * \retval 0 success
+ * \retval -1 failure
+ */
+int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module);
+
+#define ast_sorcery_apply_config(sorcery, name) \
+	__ast_sorcery_apply_config((sorcery), (name), AST_MODULE)
 
 /*!
  * \brief Apply default object wizard mappings
  *
  * \param sorcery Pointer to a sorcery structure
  * \param type Type of object to apply to
+ * \param module The name of the module, typically AST_MODULE
  * \param name Name of the wizard to use
  * \param data Data to be passed to wizard
  *
@@ -296,7 +301,10 @@
  *
  * \note Only a single default can exist per object type
  */
-int ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *name, const char *data);
+int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data);
+
+#define ast_sorcery_apply_default(sorcery, type, name, data) \
+	__ast_sorcery_apply_default((sorcery), (type), AST_MODULE, (name), (data))
 
 /*!
  * \brief Register an object type

Modified: trunk/main/config_options.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/config_options.c?view=diff&rev=381567&r1=381566&r2=381567
==============================================================================
--- trunk/main/config_options.c (original)
+++ trunk/main/config_options.c Fri Feb 15 12:44:24 2013
@@ -894,7 +894,7 @@
 /* Define as 0 if we want to allow configurations to be registered without
  * documentation
  */
-#define XMLDOC_STRICT 1
+#define XMLDOC_STRICT 0
 
 /*! \internal
  * \brief Update the XML documentation for a config type based on its registration

Modified: trunk/main/sorcery.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/sorcery.c?view=diff&rev=381567&r1=381566&r2=381567
==============================================================================
--- trunk/main/sorcery.c (original)
+++ trunk/main/sorcery.c Fri Feb 15 12:44:24 2013
@@ -330,7 +330,7 @@
 }
 
 /*! \brief Internal function which allocates an object type structure */
-static struct ast_sorcery_object_type *sorcery_object_type_alloc(const char *type)
+static struct ast_sorcery_object_type *sorcery_object_type_alloc(const char *type, const char *module)
 {
 	struct ast_sorcery_object_type *object_type;
 
@@ -361,6 +361,7 @@
 
 	object_type->info->files[0] = object_type->file;
 	object_type->info->files[1] = NULL;
+	object_type->info->module = module;
 
 	ast_copy_string(object_type->name, type, sizeof(object_type->name));
 
@@ -382,7 +383,7 @@
 }
 
 /*! \brief Internal function which creates an object type and adds a wizard mapping */
-static int sorcery_apply_wizard_mapping(struct ast_sorcery *sorcery, const char *type, const char *name, const char *data, unsigned int caching)
+static int sorcery_apply_wizard_mapping(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data, unsigned int caching)
 {
 	RAII_VAR(struct ast_sorcery_object_type *, object_type,  ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
 	RAII_VAR(struct ast_sorcery_wizard *, wizard, ao2_find(wizards, name, OBJ_KEY), ao2_cleanup);
@@ -394,7 +395,7 @@
 	}
 
 	if (!object_type) {
-		if (!(object_type = sorcery_object_type_alloc(type))) {
+		if (!(object_type = sorcery_object_type_alloc(type, module))) {
 			return -1;
 		}
 		created = 1;
@@ -418,7 +419,7 @@
 	return 0;
 }
 
-int ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name)
+int __ast_sorcery_apply_config(struct ast_sorcery *sorcery, const char *name, const char *module)
 {
 	struct ast_flags flags = { 0 };
 	struct ast_config *config = ast_config_load2("sorcery.conf", "sorcery", flags);
@@ -447,7 +448,7 @@
 		}
 
 		/* Any error immediately causes us to stop */
-		if ((res = sorcery_apply_wizard_mapping(sorcery, name, wizard, data, caching))) {
+		if ((res = sorcery_apply_wizard_mapping(sorcery, name, module, wizard, data, caching))) {
 			break;
 		}
 	}
@@ -457,7 +458,7 @@
 	return res;
 }
 
-int ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *name, const char *data)
+int __ast_sorcery_apply_default(struct ast_sorcery *sorcery, const char *type, const char *module, const char *name, const char *data)
 {
 	RAII_VAR(struct ast_sorcery_object_type *, object_type,  ao2_find(sorcery->types, type, OBJ_KEY), ao2_cleanup);
 
@@ -466,7 +467,7 @@
 		return -1;
 	}
 
-	return sorcery_apply_wizard_mapping(sorcery, type, name, data, 0);
+	return sorcery_apply_wizard_mapping(sorcery, type, module, name, data, 0);
 }
 
 int ast_sorcery_object_register(struct ast_sorcery *sorcery, const char *type, aco_type_item_alloc alloc, sorcery_transform_handler transform, sorcery_apply_handler apply)




More information about the svn-commits mailing list