summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ca9e77f)
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@20169
65c4cc65-6c06-0410-ace0-
fbb531ad65f3
{
struct ast_include *i, *pi = NULL;
{
struct ast_include *i, *pi = NULL;
- if (ast_mutex_lock(&con->lock)) return -1;
+ if (ast_mutex_lock(&con->lock))
+ return -1;
- for (i = con->includes; i; i = i->next) {
+ for (i = con->includes; i; pi = i, i = i->next) {
/* find our include */
if (!strcmp(i->name, include) &&
(!registrar || !strcmp(i->registrar, registrar))) {
/* find our include */
if (!strcmp(i->name, include) &&
(!registrar || !strcmp(i->registrar, registrar))) {
ast_mutex_unlock(&con->lock);
return 0;
}
ast_mutex_unlock(&con->lock);
return 0;
}
}
/* we can't find the right include */
}
/* we can't find the right include */
if (ast_mutex_lock(&con->lock)) return -1;
/* walk switchs */
if (ast_mutex_lock(&con->lock)) return -1;
/* walk switchs */
- for (i = con->alts; i; i = i->next) {
+ for (i = con->alts; i; pi = i, i = i->next) {
/* find our switch */
if (!strcmp(i->name, sw) && !strcmp(i->data, data) &&
(!registrar || !strcmp(i->registrar, registrar))) {
/* find our switch */
if (!strcmp(i->name, sw) && !strcmp(i->data, data) &&
(!registrar || !strcmp(i->registrar, registrar))) {
ast_mutex_unlock(&con->lock);
return 0;
}
ast_mutex_unlock(&con->lock);
return 0;
}
}
/* we can't find the right switch */
}
/* we can't find the right switch */
ast_log(LOG_ERROR, "Unable to lock switch lock\n");
return -1;
}
ast_log(LOG_ERROR, "Unable to lock switch lock\n");
return -1;
}
- for (tmp = switches; tmp; tmp = tmp->next) {
+ for (tmp = switches; tmp; prev = tmp, tmp = tmp->next) {
if (!strcasecmp(tmp->name, sw->name))
break;
if (!strcasecmp(tmp->name, sw->name))
break;
}
if (tmp) {
ast_mutex_unlock(&switchlock);
}
if (tmp) {
ast_mutex_unlock(&switchlock);
ast_log(LOG_ERROR, "Unable to lock switch lock\n");
return;
}
ast_log(LOG_ERROR, "Unable to lock switch lock\n");
return;
}
- for (tmp = switches; tmp; tmp = tmp->next) {
+ for (tmp = switches; tmp; prev = tmp, tmp = tmp->next) {
if (tmp == sw) {
if (prev)
prev->next = tmp->next;
if (tmp == sw) {
if (prev)
prev->next = tmp->next;
tmp->next = NULL;
break;
}
tmp->next = NULL;
break;
}
}
ast_mutex_unlock(&switchlock);
}
}
ast_mutex_unlock(&switchlock);
}
ast_log(LOG_ERROR, "Unable to lock switches\n");
return -1;
}
ast_log(LOG_ERROR, "Unable to lock switches\n");
return -1;
}
- for (sw = switches; sw; sw = sw->next) {
+ for (sw = switches; sw; sw = sw->next)
ast_cli(fd, "%s: %s\n", sw->name, sw->description);
ast_cli(fd, "%s: %s\n", sw->name, sw->description);
ast_mutex_unlock(&switchlock);
return RESULT_SUCCESS;
}
ast_mutex_unlock(&switchlock);
return RESULT_SUCCESS;
}
- if (dpc->total_exten == old_total_exten) {
- /* Nothing new under the sun */
- return -1;
- } else {
- return res;
- }
+ return (dpc->total_exten == old_total_exten) ? -1 : res;
}
static int handle_show_dialplan(int fd, int argc, char *argv[])
}
static int handle_show_dialplan(int fd, int argc, char *argv[])
ast_log(LOG_ERROR, "Unable to lock application list\n");
return -1;
}
ast_log(LOG_ERROR, "Unable to lock application list\n");
return -1;
}
- for (tmp = apps; tmp; tmp = tmp->next) {
+ for (tmp = apps; tmp; tmpl = tmp, tmp = tmp->next) {
if (!strcasecmp(app, tmp->name)) {
if (tmpl)
tmpl->next = tmp->next;
if (!strcasecmp(app, tmp->name)) {
if (tmpl)
tmpl->next = tmp->next;
ast_mutex_unlock(&applock);
return 0;
}
ast_mutex_unlock(&applock);
return 0;
}
}
ast_mutex_unlock(&applock);
return -1;
}
ast_mutex_unlock(&applock);
return -1;