[asterisk-commits] mmichelson: branch mmichelson/queue-penalty r93379 - /team/mmichelson/queue-p...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 17 16:38:46 CST 2007


Author: mmichelson
Date: Mon Dec 17 16:38:46 2007
New Revision: 93379

URL: http://svn.digium.com/view/asterisk?view=rev&rev=93379
Log:
A round of compilation fixes


Modified:
    team/mmichelson/queue-penalty/apps/app_queue.c

Modified: team/mmichelson/queue-penalty/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/team/mmichelson/queue-penalty/apps/app_queue.c?view=diff&rev=93379&r1=93378&r2=93379
==============================================================================
--- team/mmichelson/queue-penalty/apps/app_queue.c (original)
+++ team/mmichelson/queue-penalty/apps/app_queue.c Mon Dec 17 16:38:46 2007
@@ -367,6 +367,13 @@
 #define ANNOUNCEHOLDTIME_ALWAYS 1
 #define ANNOUNCEHOLDTIME_ONCE 2
 #define QUEUE_EVENT_VARIABLES 3
+
+struct penalty_rule {
+	int time;							/*!< Number of seconds that need to pass before applying this rule */
+	int value;                          /*!< The amount specified in the penalty rule */
+	int relative;						/*!< Is this a relative amount? 1 for relative, 0 for absolute */
+	AST_LIST_ENTRY(penalty_rule) list;  /*!< Next penalty_rule */
+};
 
 struct call_queue {
 	AST_DECLARE_STRING_FIELDS(
@@ -456,15 +463,9 @@
 	int membercount;
 	struct queue_ent *head;             /*!< Head of the list of callers */
 	AST_LIST_ENTRY(call_queue) list;    /*!< Next call queue */
-	AST_LIST_HEAD_NOLOCK_STATIC(rules, penalty_rule); /*!< The list of penalty rules to invoke */
+	AST_LIST_HEAD_NOLOCK(, penalty_rule) rules; /*!< The list of penalty rules to invoke */
 };
 
-static struct penalty_rule {
-	int time;							/*!< Number of seconds that need to pass before applying this rule */
-	int value;                          /*!< The amount specified in the penalty rule */
-	int relative;						/*!< Is this a relative amount? 1 for relative, 0 for absolute */
-	AST_LIST_ENTRY(penalty_rule) list;  /*!< Next penalty_rule */
-};
 
 static struct ao2_container *queues;
 
@@ -1013,7 +1014,7 @@
 	pr->time = time;
 
 	/*Now on to the change*/
-	if(*changeistr == '+' || *changestr == '-') {
+	if(*changestr == '+' || *changestr == '-') {
 		pr->relative = 1;
 		changestr++;
 	}
@@ -1024,7 +1025,7 @@
 		return -1;
 	}
 
-	pr->change = change;
+	pr->value = change;
 
 	/*We have the rule made, now we need to insert it where it belongs*/
 	AST_LIST_TRAVERSE_SAFE_BEGIN(&q->rules, iter, list) {
@@ -1037,7 +1038,7 @@
 	AST_LIST_TRAVERSE_SAFE_END;
 
 	if(!inserted) {
-		AST_LIST_INSERT_TAIL(&q->rules, pr);
+		AST_LIST_INSERT_TAIL(&q->rules, pr, list);
 	}
 
 	return 0;
@@ -1277,6 +1278,7 @@
 static void destroy_queue(void *obj)
 {
 	struct call_queue *q = obj;
+	struct penalty_rule *pr_iter;
 	int i;
 
 	ast_debug(0, "Queue destructor called for queue '%s'!\n", q->name);
@@ -1287,6 +1289,8 @@
 		if (q->sound_periodicannounce[i])
 			free(q->sound_periodicannounce[i]);
 	}
+	while ((pr_iter = AST_LIST_REMOVE_HEAD(&q->rules, list)))
+		ast_free(pr_iter);
 	ao2_ref(q->members, -1);
 }
 




More information about the asterisk-commits mailing list