[asterisk-commits] eliel: branch group/data_api_gsoc2009 r211709 - in /team/group/data_api_gsoc2...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Aug 11 10:11:35 CDT 2009


Author: eliel
Date: Tue Aug 11 10:11:31 2009
New Revision: 211709

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=211709
Log:
Fix a crash when passing not ast_module_info.
Allow to use the data api inside a file that is not a module.


Modified:
    team/group/data_api_gsoc2009/include/asterisk/data.h
    team/group/data_api_gsoc2009/main/data.c

Modified: team/group/data_api_gsoc2009/include/asterisk/data.h
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/include/asterisk/data.h?view=diff&rev=211709&r1=211708&r2=211709
==============================================================================
--- team/group/data_api_gsoc2009/include/asterisk/data.h (original)
+++ team/group/data_api_gsoc2009/include/asterisk/data.h Tue Aug 11 10:11:31 2009
@@ -333,6 +333,7 @@
 int __ast_data_register(const char *path, const struct ast_data_handler *handler,
 	const char *registrar, struct ast_module *mod);
 #define ast_data_register(path, handler) __ast_data_register(path, handler, __FILE__, ast_module_info->self)
+#define ast_data_register_core(path, handler) __ast_data_register(path, handler, __FILE__, NULL)
 
 /*!
  * \brief Register multiple data providers at once.
@@ -348,6 +349,8 @@
 	size_t entries, const char *registrar, struct ast_module *mod);
 #define ast_data_register_multiple(data_entries, entries) \
 	__ast_data_register_multiple(data_entries, entries, __FILE__, ast_module_info->self)
+#define ast_data_register_multiple_core(data_entries, entries) \
+	__ast_data_register_multiple(data_entries, entries, __FILE__, NULL)
 
 /*!
  * \brief Unregister a data provider.

Modified: team/group/data_api_gsoc2009/main/data.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/group/data_api_gsoc2009/main/data.c?view=diff&rev=211709&r1=211708&r2=211709
==============================================================================
--- team/group/data_api_gsoc2009/main/data.c (original)
+++ team/group/data_api_gsoc2009/main/data.c Tue Aug 11 10:11:31 2009
@@ -1567,7 +1567,9 @@
 	if (root_provider->handler && root_provider->handler->get) {
 		node->filter = filter;
 		root_provider->handler->get(search, node);
-		ast_module_unref(root_provider->module);
+		if (root_provider->module) {
+			ast_module_unref(root_provider->module);
+		}
 		return node;
 	}
 




More information about the asterisk-commits mailing list