[asterisk-commits] mmichelson: branch mmichelson/queue-penalty r93440 - /team/mmichelson/queue-p...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Dec 17 17:00:50 CST 2007
Author: mmichelson
Date: Mon Dec 17 17:00:49 2007
New Revision: 93440
URL: http://svn.digium.com/view/asterisk?view=rev&rev=93440
Log:
Coding guidelines cleanup.
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=93440&r1=93439&r2=93440
==============================================================================
--- team/mmichelson/queue-penalty/apps/app_queue.c (original)
+++ team/mmichelson/queue-penalty/apps/app_queue.c Mon Dec 17 17:00:49 2007
@@ -799,7 +799,7 @@
cur->penalty = penalty;
cur->paused = paused;
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
- if(!ast_strlen_zero(membername))
+ if (!ast_strlen_zero(membername))
ast_copy_string(cur->membername, membername, sizeof(cur->membername));
else
ast_copy_string(cur->membername, interface, sizeof(cur->membername));
@@ -862,8 +862,8 @@
q->montype = montype_default;
q->monfmt[0] = '\0';
q->periodicannouncefrequency = 0;
- if(!q->members) {
- if(q->strategy == QUEUE_STRATEGY_LINEAR)
+ if (!q->members) {
+ if (q->strategy == QUEUE_STRATEGY_LINEAR)
/* linear strategy depends on order, so we have to place all members in a single bucket */
q->members = ao2_container_alloc(1, member_hash_fn, member_cmp_fn);
else
@@ -996,7 +996,7 @@
contentdup = ast_strdupa(content);
- if(!(changestr = strchr(contentdup, ','))) {
+ if (!(changestr = strchr(contentdup, ','))) {
ast_log(LOG_WARNING, "Improperly formatted penaltychange rule at line %d. Ignoring.\n", linenum);
return -1;
}
@@ -1005,7 +1005,7 @@
timestr = contentdup;
/*Let's get the number of seconds first...*/
- if((time = atoi(timestr)) < 0) {
+ if ((time = atoi(timestr)) < 0) {
ast_log(LOG_WARNING, "Improper time parameter specified for penaltychange rule at line %d. Ignoring.\n", linenum);
ast_free(pr);
return -1;
@@ -1014,12 +1014,12 @@
pr->time = time;
/*Now on to the change*/
- if(*changestr == '+' || *changestr == '-') {
+ if (*changestr == '+' || *changestr == '-') {
pr->relative = 1;
changestr++;
}
- if((change = atoi(changestr)) < 0) {
+ if ((change = atoi(changestr)) < 0) {
ast_log(LOG_WARNING, "Improper change parameter specified for penaltychange rule at line %d. Ignoring.\n", linenum);
ast_free(pr);
return -1;
@@ -1029,7 +1029,7 @@
/*We have the rule made, now we need to insert it where it belongs*/
AST_LIST_TRAVERSE_SAFE_BEGIN(&q->rules, iter, list) {
- if(pr->time < iter->time) {
+ if (pr->time < iter->time) {
AST_LIST_INSERT_BEFORE_CURRENT(pr, list);
inserted = 1;
break;
@@ -1037,7 +1037,7 @@
}
AST_LIST_TRAVERSE_SAFE_END;
- if(!inserted) {
+ if (!inserted) {
AST_LIST_INSERT_TAIL(&q->rules, pr, list);
}
@@ -1471,14 +1471,14 @@
struct ast_variable *var;
int ret = -1;
- if(!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL)))
+ if (!(var = ast_load_realtime("queue_members", "interface", mem->interface, "queue_name", queue_name, NULL)))
return ret;
while (var) {
- if(!strcmp(var->name, "uniqueid"))
+ if (!strcmp(var->name, "uniqueid"))
break;
var = var->next;
}
- if(var && !ast_strlen_zero(var->value)) {
+ if (var && !ast_strlen_zero(var->value)) {
if ((ast_update_realtime("queue_members", "uniqueid", var->value, field, value, NULL)) > -1)
ret = 0;
}
@@ -1811,8 +1811,8 @@
ao2_unlock(q);
/*If the queue is a realtime queue, check to see if it's still defined in real time*/
- if(q->realtime) {
- if(!ast_load_realtime("queues", "name", q->name, NULL))
+ if (q->realtime) {
+ if (!ast_load_realtime("queues", "name", q->name, NULL))
q->dead = 1;
}
@@ -2294,7 +2294,7 @@
starttime = (long) time(NULL);
#ifdef HAVE_EPOLL
for (epollo = outgoing; epollo; epollo = epollo->q_next) {
- if(epollo->chan)
+ if (epollo->chan)
ast_poll_channel_add(in, epollo->chan);
}
#endif
@@ -2499,8 +2499,8 @@
}
#ifdef HAVE_EPOLL
- for(epollo = outgoing; epollo; epollo = epollo->q_next) {
- if(epollo->chan)
+ for (epollo = outgoing; epollo; epollo = epollo->q_next) {
+ if (epollo->chan)
ast_poll_channel_del(in, epollo->chan);
}
#endif
@@ -3482,7 +3482,7 @@
ao2_lock(q);
if ((mem = ao2_find(q->members, &tmpmem, OBJ_POINTER))) {
/* XXX future changes should beware of this assumption!! */
- if(!mem->dynamic) {
+ if (!mem->dynamic) {
ao2_ref(mem, -1);
ao2_unlock(q);
return RES_NOT_DYNAMIC;
@@ -3582,7 +3582,7 @@
ast_queue_log("NONE", "NONE", interface, (paused ? "PAUSEALL" : "UNPAUSEALL"), "%s", "");
queue_iter = ao2_iterator_init(queues, 0);
- while((q = ao2_iterator_next(&queue_iter))) {
+ while ((q = ao2_iterator_next(&queue_iter))) {
ao2_lock(q);
if (ast_strlen_zero(queuename) || !strcasecmp(q->name, queuename)) {
if ((mem = interface_exists(q, interface))) {
@@ -3595,7 +3595,7 @@
if (queue_persistent_members)
dump_queue_members(q);
- if(mem->realtime)
+ if (mem->realtime)
update_realtime_member_field(mem, q->name, "paused", paused ? "1" : "0");
ast_queue_log(q->name, "NONE", mem->membername, (paused ? "PAUSE" : "UNPAUSE"), "%s", S_OR(reason, ""));
@@ -4325,7 +4325,7 @@
option = "logged";
if ((q = load_realtime_queue(data))) {
ao2_lock(q);
- if(!strcasecmp(option, "logged")) {
+ if (!strcasecmp(option, "logged")) {
mem_iter = ao2_iterator_init(q->members, 0);
while ((m = ao2_iterator_next(&mem_iter))) {
/* Count the agents who are logged in and presently answering calls */
@@ -4334,7 +4334,7 @@
}
ao2_ref(m, -1);
}
- } else if(!strcasecmp(option, "free")) {
+ } else if (!strcasecmp(option, "free")) {
mem_iter = ao2_iterator_init(q->members, 0);
while ((m = ao2_iterator_next(&mem_iter))) {
/* Count the agents who are logged in and presently answering calls */
@@ -4373,7 +4373,7 @@
return -1;
}
- if((q = load_realtime_queue(data))) {
+ if ((q = load_realtime_queue(data))) {
ao2_lock(q);
mem_iter = ao2_iterator_init(q->members, 0);
while ((m = ao2_iterator_next(&mem_iter))) {
@@ -4641,7 +4641,7 @@
/* Mark all queues as dead for the moment */
queue_iter = ao2_iterator_init(queues, F_AO2I_DONTLOCK);
while ((q = ao2_iterator_next(&queue_iter))) {
- if(!q->realtime) {
+ if (!q->realtime) {
q->dead = 1;
q->found = 0;
}
@@ -4693,14 +4693,14 @@
/* Check if a queue with this name already exists */
if (q->found) {
ast_log(LOG_WARNING, "Queue '%s' already defined! Skipping!\n", cat);
- if(!new)
+ if (!new)
ao2_unlock(q);
continue;
}
/* Due to the fact that the "linear" strategy will have a different allocation
* scheme for queue members, we must devise the queue's strategy before other initializations
*/
- if((tmpvar = ast_variable_retrieve(cfg, cat, "strategy"))) {
+ if ((tmpvar = ast_variable_retrieve(cfg, cat, "strategy"))) {
q->strategy = strat2int(tmpvar);
if (q->strategy < 0) {
ast_log(LOG_WARNING, "'%s' isn't a valid strategy for queue '%s', using ringall instead\n",
@@ -4730,7 +4730,7 @@
AST_NONSTANDARD_APP_ARGS(args, parse, ',');
interface = args.interface;
- if(!ast_strlen_zero(args.penalty)) {
+ if (!ast_strlen_zero(args.penalty)) {
tmp = args.penalty;
while (*tmp && *tmp < 33) tmp++;
penalty = atoi(tmp);
@@ -4924,7 +4924,7 @@
struct ao2_iterator queue_iter;
queue_iter = ao2_iterator_init(queues, 0);
- while((q = ao2_iterator_next(&queue_iter))) {
+ while ((q = ao2_iterator_next(&queue_iter))) {
if (!strncasecmp(word, q->name, wordlen) && ++which > state) {
ret = ast_strdup(q->name);
queue_unref(q);
@@ -4994,7 +4994,7 @@
if (!ast_strlen_zero(id))
snprintf(idText, 256, "ActionID: %s\r\n", id);
queue_iter = ao2_iterator_init(queues, 0);
- while((q = ao2_iterator_next(&queue_iter))) {
+ while ((q = ao2_iterator_next(&queue_iter))) {
ao2_lock(q);
/* List queue properties */
@@ -5523,19 +5523,19 @@
reason = a->argc == 8 ? a->argv[7] : NULL;
paused = !strcasecmp(a->argv[1], "pause");
- if(set_member_paused(queuename, interface, reason, paused) == RESULT_SUCCESS) {
+ if (set_member_paused(queuename, interface, reason, paused) == RESULT_SUCCESS) {
ast_cli(a->fd, "%spaused interface '%s'", paused ? "" : "un", interface);
- if(!ast_strlen_zero(queuename))
+ if (!ast_strlen_zero(queuename))
ast_cli(a->fd, " in queue '%s'", queuename);
- if(!ast_strlen_zero(reason))
+ if (!ast_strlen_zero(reason))
ast_cli(a->fd, " for reason '%s'", reason);
ast_cli(a->fd, "\n");
return CLI_SUCCESS;
} else {
ast_cli(a->fd, "Unable to %spause interface '%s'", paused ? "" : "un", interface);
- if(!ast_strlen_zero(queuename))
+ if (!ast_strlen_zero(queuename))
ast_cli(a->fd, " in queue '%s'", queuename);
- if(!ast_strlen_zero(reason))
+ if (!ast_strlen_zero(reason))
ast_cli(a->fd, " for reason '%s'", reason);
ast_cli(a->fd, "\n");
return CLI_FAILURE;
@@ -5588,7 +5588,7 @@
return CLI_SHOWUSAGE;
}
- if(a->argc == 8)
+ if (a->argc == 8)
queuename = a->argv[7];
interface = a->argv[5];
penalty = atoi(a->argv[3]);
More information about the asterisk-commits
mailing list