[asterisk-commits] seanbright: branch 1.4 r191422 - /branches/1.4/apps/app_queue.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri May 1 10:42:49 CDT 2009


Author: seanbright
Date: Fri May  1 10:42:48 2009
New Revision: 191422

URL: http://svn.digium.com/svn-view/asterisk?view=rev&rev=191422
Log:
Move the defintion of the a couple arrays out of loops.

According to Kevin, it is unspecified as to whether a variable defined inside
a block is allocated once by the compiler or for each pass through the block
(loops being the only interesting case), so just define these before we get
into our loop to be sure.

Modified:
    branches/1.4/apps/app_queue.c

Modified: branches/1.4/apps/app_queue.c
URL: http://svn.digium.com/svn-view/asterisk/branches/1.4/apps/app_queue.c?view=diff&rev=191422&r1=191421&r2=191422
==============================================================================
--- branches/1.4/apps/app_queue.c (original)
+++ branches/1.4/apps/app_queue.c Fri May  1 10:42:48 2009
@@ -594,13 +594,13 @@
 	struct member *cur;
 	struct ao2_iterator mem_iter;
 	struct call_queue *q;
+	char tmp_interface[80];
 
 	AST_LIST_LOCK(&queues);
 	AST_LIST_TRAVERSE(&queues, q, list) {
 		ast_mutex_lock(&q->lock);
 		mem_iter = ao2_iterator_init(q->members, 0);
 		while ((cur = ao2_iterator_next(&mem_iter))) {
-			char tmp_interface[80];
 			char *slash_pos;
 			ast_copy_string(tmp_interface, cur->state_interface, sizeof(tmp_interface));
 			if ((slash_pos = strchr(tmp_interface, '/')))
@@ -647,6 +647,7 @@
 	struct member_interface *curint;
 	char *loc;
 	char *technology;
+	char interface[80];
 
 	technology = ast_strdupa(sc->dev);
 	loc = strchr(technology, '/');
@@ -658,7 +659,6 @@
 
 	AST_LIST_LOCK(&interfaces);
 	AST_LIST_TRAVERSE(&interfaces, curint, list) {
-		char interface[80];
 		char *slash_pos;
 		ast_copy_string(interface, curint->interface, sizeof(interface));
 		if ((slash_pos = strchr(interface, '/')))




More information about the asterisk-commits mailing list