[asterisk-commits] twilson: trunk r342225 - in /trunk: ./ include/asterisk/config.h main/config.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 24 20:29:37 CDT 2011


Author: twilson
Date: Mon Oct 24 20:29:32 2011
New Revision: 342225

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=342225
Log:
Return NULL when no results returned for realtime_multientry

It was not documented what the return value should be when no entries
were returned with the multientry realtime callback. This change forces
consistent behavior even if the backends return an empty ast_config.

Review: https://reviewboard.asterisk.org/r/1521/
........

Merged revisions 342223 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........

Merged revisions 342224 from http://svn.asterisk.org/svn/asterisk/branches/10

Modified:
    trunk/   (props changed)
    trunk/include/asterisk/config.h
    trunk/main/config.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-10-merged' - no diff available.

Modified: trunk/include/asterisk/config.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/config.h?view=diff&rev=342225&r1=342224&r2=342225
==============================================================================
--- trunk/include/asterisk/config.h (original)
+++ trunk/include/asterisk/config.h Mon Oct 24 20:29:32 2011
@@ -357,6 +357,9 @@
  * the ast_load_realtime, this function can return more than one entry and
  * is thus stored inside a traditional ast_config structure rather than
  * just returning a linked list of variables.
+ *
+ * \return An ast_config with one or more results
+ * \retval NULL Error or no results returned
  *
  * \note You should use the constant SENTINEL to terminate arguments, in
  * order to preserve cross-platform compatibility.

Modified: trunk/main/config.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/config.c?view=diff&rev=342225&r1=342224&r2=342225
==============================================================================
--- trunk/main/config.c (original)
+++ trunk/main/config.c Mon Oct 24 20:29:32 2011
@@ -2446,6 +2446,11 @@
 	for (i = 1; ; i++) {
 		if ((eng = find_engine(family, i, db, sizeof(db), table, sizeof(table)))) {
 			if (eng->realtime_multi_func && (res = eng->realtime_multi_func(db, table, ap))) {
+				/* If we were returned an empty cfg, destroy it and return NULL */
+				if (!res->root) {
+					ast_config_destroy(res);
+					res = NULL;
+				}
 				break;
 			}
 		} else {




More information about the asterisk-commits mailing list