[asterisk-commits] kpfleming: branch 1.2 r43916 -
/branches/1.2/apps/app_queue.c
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Thu Sep 28 10:31:58 MST 2006
Author: kpfleming
Date: Thu Sep 28 12:31:57 2006
New Revision: 43916
URL: http://svn.digium.com/view/asterisk?rev=43916&view=rev
Log:
fix buggy (and overly complex) loop used during reload of app_queue for static member list updating
Modified:
branches/1.2/apps/app_queue.c
Modified: branches/1.2/apps/app_queue.c
URL: http://svn.digium.com/view/asterisk/branches/1.2/apps/app_queue.c?rev=43916&r1=43915&r2=43916&view=diff
==============================================================================
--- branches/1.2/apps/app_queue.c (original)
+++ branches/1.2/apps/app_queue.c Thu Sep 28 12:31:57 2006
@@ -3306,7 +3306,7 @@
struct ast_config *cfg;
char *cat, *tmp;
struct ast_variable *var;
- struct member *prev, *cur, *newm;
+ struct member *prev, *cur, *newm, *next;
int new;
char *general_val = NULL;
char interface[80];
@@ -3405,23 +3405,21 @@
}
/* Free remaining members marked as delme */
- for (prev = NULL, newm = NULL, cur = q->members; cur; prev = cur, cur = cur->next) {
- if (newm) {
- free(newm);
- newm = NULL;
- }
-
- if (cur->delme) {
- if (prev) {
- prev->next = cur->next;
- newm = cur;
- } else {
- q->members = cur->next;
- newm = cur;
- }
- remove_from_interfaces(cur->interface);
- }
+ for (prev = NULL, cur = q->members, next = cur ? cur->next : NULL;
+ cur;
+ cur = next, next = cur ? cur->next : NULL) {
+ if (!cur->delme)
+ continue;
+
+ if (prev)
+ prev->next = next;
+ else
+ q->members = next;
+
+ remove_from_interfaces(cur->interface);
+ free(cur);
}
+
if (!new)
ast_mutex_unlock(&q->lock);
if (new) {
More information about the asterisk-commits
mailing list