mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-09 19:38:22 +00:00
Whitespace Fixups / Add Braces
This janitorial patch is related to work on RB1538 git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.8@341906 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1606,16 +1606,19 @@ static struct member *create_queue_member(const char *interface, const char *mem
|
|||||||
cur->penalty = penalty;
|
cur->penalty = penalty;
|
||||||
cur->paused = paused;
|
cur->paused = paused;
|
||||||
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
|
ast_copy_string(cur->interface, interface, sizeof(cur->interface));
|
||||||
if (!ast_strlen_zero(state_interface))
|
if (!ast_strlen_zero(state_interface)) {
|
||||||
ast_copy_string(cur->state_interface, state_interface, sizeof(cur->state_interface));
|
ast_copy_string(cur->state_interface, state_interface, sizeof(cur->state_interface));
|
||||||
else
|
} else {
|
||||||
ast_copy_string(cur->state_interface, interface, sizeof(cur->state_interface));
|
ast_copy_string(cur->state_interface, interface, sizeof(cur->state_interface));
|
||||||
if (!ast_strlen_zero(membername))
|
}
|
||||||
|
if (!ast_strlen_zero(membername)) {
|
||||||
ast_copy_string(cur->membername, membername, sizeof(cur->membername));
|
ast_copy_string(cur->membername, membername, sizeof(cur->membername));
|
||||||
else
|
} else {
|
||||||
ast_copy_string(cur->membername, interface, sizeof(cur->membername));
|
ast_copy_string(cur->membername, interface, sizeof(cur->membername));
|
||||||
if (!strchr(cur->interface, '/'))
|
}
|
||||||
|
if (!strchr(cur->interface, '/')) {
|
||||||
ast_log(LOG_WARNING, "No location at interface '%s'\n", interface);
|
ast_log(LOG_WARNING, "No location at interface '%s'\n", interface);
|
||||||
|
}
|
||||||
if (!strncmp(cur->state_interface, "hint:", 5)) {
|
if (!strncmp(cur->state_interface, "hint:", 5)) {
|
||||||
char *tmp = ast_strdupa(cur->state_interface), *context = tmp;
|
char *tmp = ast_strdupa(cur->state_interface), *context = tmp;
|
||||||
char *exten = strsep(&context, "@") + 5;
|
char *exten = strsep(&context, "@") + 5;
|
||||||
@@ -2102,8 +2105,9 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
|
|||||||
|
|
||||||
if (paused_str) {
|
if (paused_str) {
|
||||||
paused = atoi(paused_str);
|
paused = atoi(paused_str);
|
||||||
if (paused < 0)
|
if (paused < 0) {
|
||||||
paused = 0;
|
paused = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find member by realtime uniqueid and update */
|
/* Find member by realtime uniqueid and update */
|
||||||
@@ -2112,8 +2116,9 @@ static void rt_handle_member_record(struct call_queue *q, char *interface, const
|
|||||||
if (!strcasecmp(m->rt_uniqueid, rt_uniqueid)) {
|
if (!strcasecmp(m->rt_uniqueid, rt_uniqueid)) {
|
||||||
m->dead = 0; /* Do not delete this one. */
|
m->dead = 0; /* Do not delete this one. */
|
||||||
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
|
ast_copy_string(m->rt_uniqueid, rt_uniqueid, sizeof(m->rt_uniqueid));
|
||||||
if (paused_str)
|
if (paused_str) {
|
||||||
m->paused = paused;
|
m->paused = paused;
|
||||||
|
}
|
||||||
if (strcasecmp(state_interface, m->state_interface)) {
|
if (strcasecmp(state_interface, m->state_interface)) {
|
||||||
ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
|
ast_copy_string(m->state_interface, state_interface, sizeof(m->state_interface));
|
||||||
}
|
}
|
||||||
@@ -2224,10 +2229,10 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
|||||||
return q;
|
return q;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (!member_config)
|
} else if (!member_config) {
|
||||||
/* Not found in the list, and it's not realtime ... */
|
/* Not found in the list, and it's not realtime ... */
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
/* Check if queue is defined in realtime. */
|
/* Check if queue is defined in realtime. */
|
||||||
if (!queue_vars) {
|
if (!queue_vars) {
|
||||||
/* Delete queue from in-core list if it has been deleted in realtime. */
|
/* Delete queue from in-core list if it has been deleted in realtime. */
|
||||||
@@ -2249,8 +2254,9 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
|||||||
/* Create a new queue if an in-core entry does not exist yet. */
|
/* Create a new queue if an in-core entry does not exist yet. */
|
||||||
if (!q) {
|
if (!q) {
|
||||||
struct ast_variable *tmpvar = NULL;
|
struct ast_variable *tmpvar = NULL;
|
||||||
if (!(q = alloc_queue(queuename)))
|
if (!(q = alloc_queue(queuename))) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
ao2_lock(q);
|
ao2_lock(q);
|
||||||
clear_queue(q);
|
clear_queue(q);
|
||||||
q->realtime = 1;
|
q->realtime = 1;
|
||||||
@@ -2270,8 +2276,9 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* We traversed all variables and didn't find a strategy */
|
/* We traversed all variables and didn't find a strategy */
|
||||||
if (!tmpvar)
|
if (!tmpvar) {
|
||||||
q->strategy = QUEUE_STRATEGY_RINGALL;
|
q->strategy = QUEUE_STRATEGY_RINGALL;
|
||||||
|
}
|
||||||
queues_t_link(queues, q, "Add queue to container");
|
queues_t_link(queues, q, "Add queue to container");
|
||||||
}
|
}
|
||||||
init_queue(q); /* Ensure defaults for all parameters not set explicitly. */
|
init_queue(q); /* Ensure defaults for all parameters not set explicitly. */
|
||||||
@@ -2299,8 +2306,9 @@ static struct call_queue *find_queue_by_name_rt(const char *queuename, struct as
|
|||||||
mem_iter = ao2_iterator_init(q->members, 0);
|
mem_iter = ao2_iterator_init(q->members, 0);
|
||||||
while ((m = ao2_iterator_next(&mem_iter))) {
|
while ((m = ao2_iterator_next(&mem_iter))) {
|
||||||
q->membercount++;
|
q->membercount++;
|
||||||
if (m->realtime)
|
if (m->realtime) {
|
||||||
m->dead = 1;
|
m->dead = 1;
|
||||||
|
}
|
||||||
ao2_ref(m, -1);
|
ao2_ref(m, -1);
|
||||||
}
|
}
|
||||||
ao2_iterator_destroy(&mem_iter);
|
ao2_iterator_destroy(&mem_iter);
|
||||||
@@ -2458,9 +2466,9 @@ static int join_queue(char *queuename, struct queue_ent *qe, enum queue_result *
|
|||||||
int pos = 0;
|
int pos = 0;
|
||||||
int inserted = 0;
|
int inserted = 0;
|
||||||
|
|
||||||
if (!(q = load_realtime_queue(queuename)))
|
if (!(q = load_realtime_queue(queuename))) {
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
ao2_lock(q);
|
ao2_lock(q);
|
||||||
|
|
||||||
/* This is our one */
|
/* This is our one */
|
||||||
@@ -2769,8 +2777,9 @@ static void leave_queue(struct queue_ent *qe)
|
|||||||
struct penalty_rule *pr_iter;
|
struct penalty_rule *pr_iter;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
|
||||||
if (!(q = qe->parent))
|
if (!(q = qe->parent)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
queue_t_ref(q, "Copy queue pointer from queue entry");
|
queue_t_ref(q, "Copy queue pointer from queue entry");
|
||||||
ao2_lock(q);
|
ao2_lock(q);
|
||||||
|
|
||||||
@@ -5113,9 +5122,9 @@ static struct member *interface_exists(struct call_queue *q, const char *interfa
|
|||||||
struct member *mem;
|
struct member *mem;
|
||||||
struct ao2_iterator mem_iter;
|
struct ao2_iterator mem_iter;
|
||||||
|
|
||||||
if (!q)
|
if (!q) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
mem_iter = ao2_iterator_init(q->members, 0);
|
mem_iter = ao2_iterator_init(q->members, 0);
|
||||||
while ((mem = ao2_iterator_next(&mem_iter))) {
|
while ((mem = ao2_iterator_next(&mem_iter))) {
|
||||||
if (!strcasecmp(interface, mem->interface)) {
|
if (!strcasecmp(interface, mem->interface)) {
|
||||||
@@ -5238,8 +5247,9 @@ static int add_to_queue(const char *queuename, const char *interface, const char
|
|||||||
|
|
||||||
/*! \note Ensure the appropriate realtime queue is loaded. Note that this
|
/*! \note Ensure the appropriate realtime queue is loaded. Note that this
|
||||||
* short-circuits if the queue is already in memory. */
|
* short-circuits if the queue is already in memory. */
|
||||||
if (!(q = load_realtime_queue(queuename)))
|
if (!(q = load_realtime_queue(queuename))) {
|
||||||
return res;
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
ao2_lock(q);
|
ao2_lock(q);
|
||||||
if ((old_member = interface_exists(q, interface)) == NULL) {
|
if ((old_member = interface_exists(q, interface)) == NULL) {
|
||||||
@@ -5265,8 +5275,9 @@ static int add_to_queue(const char *queuename, const char *interface, const char
|
|||||||
ao2_ref(new_member, -1);
|
ao2_ref(new_member, -1);
|
||||||
new_member = NULL;
|
new_member = NULL;
|
||||||
|
|
||||||
if (dump)
|
if (dump) {
|
||||||
dump_queue_members(q);
|
dump_queue_members(q);
|
||||||
|
}
|
||||||
|
|
||||||
res = RES_OKAY;
|
res = RES_OKAY;
|
||||||
} else {
|
} else {
|
||||||
@@ -5431,10 +5442,11 @@ static int get_member_penalty(char *queuename, char *interface)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* some useful debuging */
|
/* some useful debuging */
|
||||||
if (foundqueue)
|
if (foundqueue) {
|
||||||
ast_log (LOG_ERROR, "Invalid queuename\n");
|
ast_log (LOG_ERROR, "Invalid queuename\n");
|
||||||
else
|
} else {
|
||||||
ast_log (LOG_ERROR, "Invalid interface\n");
|
ast_log (LOG_ERROR, "Invalid interface\n");
|
||||||
|
}
|
||||||
|
|
||||||
return RESULT_FAILURE;
|
return RESULT_FAILURE;
|
||||||
}
|
}
|
||||||
@@ -5470,8 +5482,9 @@ static void reload_queue_members(void)
|
|||||||
cur_queue = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Reload queue members");
|
cur_queue = ao2_t_find(queues, &tmpq, OBJ_POINTER, "Reload queue members");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cur_queue)
|
if (!cur_queue) {
|
||||||
cur_queue = load_realtime_queue(queue_name);
|
cur_queue = load_realtime_queue(queue_name);
|
||||||
|
}
|
||||||
|
|
||||||
if (!cur_queue) {
|
if (!cur_queue) {
|
||||||
/* If the queue no longer exists, remove it from the
|
/* If the queue no longer exists, remove it from the
|
||||||
@@ -6267,8 +6280,9 @@ static int queue_function_qac_dep(struct ast_channel *chan, const char *cmd, cha
|
|||||||
ao2_iterator_destroy(&mem_iter);
|
ao2_iterator_destroy(&mem_iter);
|
||||||
ao2_unlock(q);
|
ao2_unlock(q);
|
||||||
queue_t_unref(q, "Done with temporary reference in QUEUE_MEMBER_COUNT");
|
queue_t_unref(q, "Done with temporary reference in QUEUE_MEMBER_COUNT");
|
||||||
} else
|
} else {
|
||||||
ast_log(LOG_WARNING, "queue %s was not found\n", data);
|
ast_log(LOG_WARNING, "queue %s was not found\n", data);
|
||||||
|
}
|
||||||
|
|
||||||
snprintf(buf, len, "%d", count);
|
snprintf(buf, len, "%d", count);
|
||||||
|
|
||||||
@@ -6913,8 +6927,9 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
|||||||
struct ao2_iterator queue_iter;
|
struct ao2_iterator queue_iter;
|
||||||
struct ao2_iterator mem_iter;
|
struct ao2_iterator mem_iter;
|
||||||
|
|
||||||
if (argc != 2 && argc != 3)
|
if (argc != 2 && argc != 3) {
|
||||||
return CLI_SHOWUSAGE;
|
return CLI_SHOWUSAGE;
|
||||||
|
}
|
||||||
|
|
||||||
if (argc == 3) { /* specific queue */
|
if (argc == 3) { /* specific queue */
|
||||||
if ((q = load_realtime_queue(argv[2]))) {
|
if ((q = load_realtime_queue(argv[2]))) {
|
||||||
@@ -6976,9 +6991,9 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
|||||||
int2strat(q->strategy), q->holdtime, q->talktime, q->weight,
|
int2strat(q->strategy), q->holdtime, q->talktime, q->weight,
|
||||||
q->callscompleted, q->callsabandoned,sl,q->servicelevel);
|
q->callscompleted, q->callsabandoned,sl,q->servicelevel);
|
||||||
do_print(s, fd, ast_str_buffer(out));
|
do_print(s, fd, ast_str_buffer(out));
|
||||||
if (!ao2_container_count(q->members))
|
if (!ao2_container_count(q->members)) {
|
||||||
do_print(s, fd, " No Members");
|
do_print(s, fd, " No Members");
|
||||||
else {
|
} else {
|
||||||
struct member *mem;
|
struct member *mem;
|
||||||
|
|
||||||
do_print(s, fd, " Members: ");
|
do_print(s, fd, " Members: ");
|
||||||
@@ -6988,26 +7003,28 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
|||||||
if (strcasecmp(mem->membername, mem->interface)) {
|
if (strcasecmp(mem->membername, mem->interface)) {
|
||||||
ast_str_append(&out, 0, " (%s)", mem->interface);
|
ast_str_append(&out, 0, " (%s)", mem->interface);
|
||||||
}
|
}
|
||||||
if (mem->penalty)
|
if (mem->penalty) {
|
||||||
ast_str_append(&out, 0, " with penalty %d", mem->penalty);
|
ast_str_append(&out, 0, " with penalty %d", mem->penalty);
|
||||||
|
}
|
||||||
ast_str_append(&out, 0, "%s%s%s (%s)",
|
ast_str_append(&out, 0, "%s%s%s (%s)",
|
||||||
mem->dynamic ? " (dynamic)" : "",
|
mem->dynamic ? " (dynamic)" : "",
|
||||||
mem->realtime ? " (realtime)" : "",
|
mem->realtime ? " (realtime)" : "",
|
||||||
mem->paused ? " (paused)" : "",
|
mem->paused ? " (paused)" : "",
|
||||||
ast_devstate2str(mem->status));
|
ast_devstate2str(mem->status));
|
||||||
if (mem->calls)
|
if (mem->calls) {
|
||||||
ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago)",
|
ast_str_append(&out, 0, " has taken %d calls (last was %ld secs ago)",
|
||||||
mem->calls, (long) (time(NULL) - mem->lastcall));
|
mem->calls, (long) (time(NULL) - mem->lastcall));
|
||||||
else
|
} else {
|
||||||
ast_str_append(&out, 0, " has taken no calls yet");
|
ast_str_append(&out, 0, " has taken no calls yet");
|
||||||
|
}
|
||||||
do_print(s, fd, ast_str_buffer(out));
|
do_print(s, fd, ast_str_buffer(out));
|
||||||
ao2_ref(mem, -1);
|
ao2_ref(mem, -1);
|
||||||
}
|
}
|
||||||
ao2_iterator_destroy(&mem_iter);
|
ao2_iterator_destroy(&mem_iter);
|
||||||
}
|
}
|
||||||
if (!q->head)
|
if (!q->head) {
|
||||||
do_print(s, fd, " No Callers");
|
do_print(s, fd, " No Callers");
|
||||||
else {
|
} else {
|
||||||
struct queue_ent *qe;
|
struct queue_ent *qe;
|
||||||
int pos = 1;
|
int pos = 1;
|
||||||
|
|
||||||
@@ -7026,10 +7043,11 @@ static char *__queues_show(struct mansession *s, int fd, int argc, const char *
|
|||||||
ao2_iterator_destroy(&queue_iter);
|
ao2_iterator_destroy(&queue_iter);
|
||||||
ao2_unlock(queues);
|
ao2_unlock(queues);
|
||||||
if (!found) {
|
if (!found) {
|
||||||
if (argc == 3)
|
if (argc == 3) {
|
||||||
ast_str_set(&out, 0, "No such queue: %s.", argv[2]);
|
ast_str_set(&out, 0, "No such queue: %s.", argv[2]);
|
||||||
else
|
} else {
|
||||||
ast_str_set(&out, 0, "No queues.");
|
ast_str_set(&out, 0, "No queues.");
|
||||||
|
}
|
||||||
do_print(s, fd, ast_str_buffer(out));
|
do_print(s, fd, ast_str_buffer(out));
|
||||||
}
|
}
|
||||||
return CLI_SUCCESS;
|
return CLI_SUCCESS;
|
||||||
|
|||||||
Reference in New Issue
Block a user