[asterisk-commits] russell: branch russell/ast_channel_ao2 r183544 - in /team/russell/ast_channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 20 07:31:46 CDT 2009


Author: russell
Date: Fri Mar 20 07:31:42 2009
New Revision: 183544

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=183544
Log:
Address some comments from vadim, thanks!

Modified:
    team/russell/ast_channel_ao2/apps/app_directed_pickup.c
    team/russell/ast_channel_ao2/res/snmp/agent.c

Modified: team/russell/ast_channel_ao2/apps/app_directed_pickup.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/apps/app_directed_pickup.c?view=diff&rev=183544&r1=183543&r2=183544
==============================================================================
--- team/russell/ast_channel_ao2/apps/app_directed_pickup.c (original)
+++ team/russell/ast_channel_ao2/apps/app_directed_pickup.c Fri Mar 20 07:31:42 2009
@@ -124,7 +124,7 @@
 /*! \brief Helper Function to walk through ALL channels checking NAME and STATE */
 static struct ast_channel *my_ast_get_channel_by_name_locked(const char *channame)
 {
-	struct ast_channel *chan;
+	struct ast_channel *chan = NULL;
 	char *chkchan;
 	size_t channame_len, chkchan_len;
 	struct ast_channel_iterator *iter;
@@ -132,7 +132,7 @@
 	channame_len = strlen(channame);
 	chkchan_len = channame_len + 2;
 
- 	chkchan = alloca(chkchan_len);
+	chkchan = alloca(chkchan_len);
 
 	/* need to append a '-' for the comparison so we check full channel name,
 	 * i.e SIP/hgc- , use a temporary variable so original stays the same for
@@ -148,7 +148,7 @@
 	while ((chan = ast_channel_iterator_next(iter))) {
 		ast_channel_lock(chan);
 		if (!strncasecmp(chan->name, chkchan, chkchan_len) && can_pickup(chan)) {
-			return chan;
+			break;
 		}
 		ast_channel_unlock(chan);
 		chan = ast_channel_unref(chan);
@@ -156,7 +156,7 @@
 
 	ast_channel_iterator_destroy(iter);
 
-	return NULL;
+	return chan;
 }
 
 /*! \brief Attempt to pick up specified channel named , does not use context */
@@ -194,7 +194,7 @@
 		if (can_pickup(target)) {
 			break;
 		}
-		ast_channel_unlock(chan);
+		ast_channel_unlock(target);
 		target = ast_channel_unref(target);
 	}
 

Modified: team/russell/ast_channel_ao2/res/snmp/agent.c
URL: http://svn.digium.com/svn-view/asterisk/team/russell/ast_channel_ao2/res/snmp/agent.c?view=diff&rev=183544&r1=183543&r2=183544
==============================================================================
--- team/russell/ast_channel_ao2/res/snmp/agent.c (original)
+++ team/russell/ast_channel_ao2/res/snmp/agent.c Fri Mar 20 07:31:42 2009
@@ -593,11 +593,9 @@
 		}
 
 		while ((chan = ast_channel_iterator_next(iter))) {
-			ast_channel_lock(chan);
 			if (chan->tech == tech) {
 				long_ret++;
 			}
-			ast_channel_unlock(chan);
 			chan = ast_channel_unref(chan);
 		}
 




More information about the asterisk-commits mailing list