[asterisk-commits] dlee: branch group/performance r399775 - /team/group/performance/main/channel.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Sep 25 09:19:44 CDT 2013


Author: dlee
Date: Wed Sep 25 09:19:41 2013
New Revision: 399775

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=399775
Log:
Minor improvement to channel snapshot overhead when there are no manager variables

Modified:
    team/group/performance/main/channel.c

Modified: team/group/performance/main/channel.c
URL: http://svnview.digium.com/svn/asterisk/team/group/performance/main/channel.c?view=diff&rev=399775&r1=399774&r2=399775
==============================================================================
--- team/group/performance/main/channel.c (original)
+++ team/group/performance/main/channel.c Wed Sep 25 09:19:41 2013
@@ -7552,14 +7552,19 @@
 	RAII_VAR(struct ast_str *, tmp, NULL, ast_free);
 	struct manager_channel_variable *mcv;
 
+	if (!ret || !tmp) {
+		return NULL;
+	}
+
+	AST_RWLIST_RDLOCK(&channelvars);
+
+	if (AST_LIST_EMPTY(&channelvars)) {
+		return NULL;
+	}
+
 	ret = ao2_alloc(sizeof(*ret), varshead_dtor);
 	tmp = ast_str_create(16);
 
-	if (!ret || !tmp) {
-		return NULL;
-	}
-
-	AST_RWLIST_RDLOCK(&channelvars);
 	AST_LIST_TRAVERSE(&channelvars, mcv, entry) {
 		const char *val = NULL;
 		struct ast_var_t *var;




More information about the asterisk-commits mailing list