[asterisk-commits] mmichelson: branch 1.8-digiumphones r360031 - /branches/1.8-digiumphones/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Mar 20 14:30:10 CDT 2012


Author: mmichelson
Date: Tue Mar 20 14:30:07 2012
New Revision: 360031

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=360031
Log:
Get rid of an annoying "Possible programming error" message.

If an extension's 'app' field is NULL, then a "(null)" string
would be written into an ast_str due to the way that snprintf
works. When this is passed to ast_strlen_zero(), it fires up
a big warning indicating something is probably wrong.

There indeed was a problem, but luckily it wasn't a very big
problem. After the failed ast_strlen_zero() check and big
warning message, the very next if statement, checking to
see if the "(null)" matched a presence provider, would fail,
so no harm was done.


Modified:
    branches/1.8-digiumphones/main/pbx.c

Modified: branches/1.8-digiumphones/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.8-digiumphones/main/pbx.c?view=diff&rev=360031&r1=360030&r2=360031
==============================================================================
--- branches/1.8-digiumphones/main/pbx.c (original)
+++ branches/1.8-digiumphones/main/pbx.c Tue Mar 20 14:30:07 2012
@@ -4546,6 +4546,7 @@
 	i = ao2_iterator_init(hints, 0);
 	for (; (hint = ao2_iterator_next(&i)); ao2_ref(hint, -1)) {
 		struct ast_state_cb *state_cb;
+		const char *app;
 		char *parse;
 
 		ao2_lock(hint);
@@ -4557,14 +4558,14 @@
 		}
 
 		/* Does this hint monitor the device that changed state? */
-		ast_str_set(&hint_app, 0, "%s", ast_get_extension_app(hint->exten));
-		parse = parse_hint_presence(hint_app);
-		if (ast_strlen_zero(parse)) {
+		app = ast_get_extension_app(hint->exten);
+		if (ast_strlen_zero(app)) {
 			/* The hint does not monitor presence at all. */
 			ao2_unlock(hint);
 			continue;
 		}
-
+		ast_str_set(&hint_app, 0, "%s", app);
+		parse = parse_hint_presence(hint_app);
 		if (strcasecmp(parse, pc->provider)) {
 			/* The hint does not monitor the presence provider. */
 			ao2_unlock(hint);




More information about the asterisk-commits mailing list