fix indentation for this function

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@23491 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.4
Russell Bryant 20 years ago
parent fcb2809e45
commit 149e45924a

@ -3988,64 +3988,64 @@ static void build_mapping(char *name, char *value)
if (!(t = ast_strdupa(value))) if (!(t = ast_strdupa(value)))
return; return;
AST_LIST_TRAVERSE(&mappings, map, list) { AST_LIST_TRAVERSE(&mappings, map, list) {
/* Find a double match */ /* Find a double match */
if (!strcasecmp(map->dcontext, name) && if (!strcasecmp(map->dcontext, name) &&
(!strncasecmp(map->lcontext, value, strlen(map->lcontext)) && (!strncasecmp(map->lcontext, value, strlen(map->lcontext)) &&
(!value[strlen(map->lcontext)] || (!value[strlen(map->lcontext)] ||
(value[strlen(map->lcontext)] == ',')))) (value[strlen(map->lcontext)] == ','))))
break; break;
} }
if (!map) { if (!map) {
if (!(map = ast_calloc(1, sizeof(*map)))) if (!(map = ast_calloc(1, sizeof(*map))))
return; return;
AST_LIST_INSERT_HEAD(&mappings, map, list); AST_LIST_INSERT_HEAD(&mappings, map, list);
map->dead = 1; map->dead = 1;
}
map->options = 0;
memset(fields, 0, sizeof(fields));
x = 0;
while (t && x < MAX_OPTS) {
fields[x++] = t;
t = strchr(t, ',');
if (t) {
*t = '\0';
t++;
} }
map->options = 0; } /* Russell was here, arrrr! */
memset(fields, 0, sizeof(fields)); if ((x == 1) && ast_strlen_zero(fields[0])) {
x = 0; /* Placeholder mapping */
while (t && x < MAX_OPTS) { ast_copy_string(map->dcontext, name, sizeof(map->dcontext));
fields[x++] = t; map->dead = 0;
t = strchr(t, ','); } else if (x >= 4) {
if (t) { ast_copy_string(map->dcontext, name, sizeof(map->dcontext));
*t = '\0'; ast_copy_string(map->lcontext, fields[0], sizeof(map->lcontext));
t++; if ((sscanf(fields[1], "%d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) {
ast_copy_string(map->dest, fields[3], sizeof(map->dest));
if ((map->tech = str2tech(fields[2]))) {
map->dead = 0;
} }
} /* Russell was here, arrrr! */ } else {
if ((x == 1) && ast_strlen_zero(fields[0])) { ast_log(LOG_WARNING, "Invalid weight '%s' specified, deleting entry '%s/%s'\n", fields[1], map->dcontext, map->lcontext);
/* Placeholder mapping */ }
ast_copy_string(map->dcontext, name, sizeof(map->dcontext)); for (y = 4;y < x; y++) {
map->dead = 0; if (!strcasecmp(fields[y], "nounsolicited"))
} else if (x >= 4) { map->options |= DUNDI_FLAG_NOUNSOLICITED;
ast_copy_string(map->dcontext, name, sizeof(map->dcontext)); else if (!strcasecmp(fields[y], "nocomunsolicit"))
ast_copy_string(map->lcontext, fields[0], sizeof(map->lcontext)); map->options |= DUNDI_FLAG_NOCOMUNSOLICIT;
if ((sscanf(fields[1], "%d", &map->weight) == 1) && (map->weight >= 0) && (map->weight < 60000)) { else if (!strcasecmp(fields[y], "residential"))
ast_copy_string(map->dest, fields[3], sizeof(map->dest)); map->options |= DUNDI_FLAG_RESIDENTIAL;
if ((map->tech = str2tech(fields[2]))) { else if (!strcasecmp(fields[y], "commercial"))
map->dead = 0; map->options |= DUNDI_FLAG_COMMERCIAL;
} else if (!strcasecmp(fields[y], "mobile"))
} else { map->options |= DUNDI_FLAG_MOBILE;
ast_log(LOG_WARNING, "Invalid weight '%s' specified, deleting entry '%s/%s'\n", fields[1], map->dcontext, map->lcontext); else if (!strcasecmp(fields[y], "nopartial"))
} map->options |= DUNDI_FLAG_INTERNAL_NOPARTIAL;
for (y = 4;y < x; y++) { else
if (!strcasecmp(fields[y], "nounsolicited")) ast_log(LOG_WARNING, "Don't know anything about option '%s'\n", fields[y]);
map->options |= DUNDI_FLAG_NOUNSOLICITED; }
else if (!strcasecmp(fields[y], "nocomunsolicit")) } else
map->options |= DUNDI_FLAG_NOCOMUNSOLICIT; ast_log(LOG_WARNING, "Expected at least %d arguments in map, but got only %d\n", 4, x);
else if (!strcasecmp(fields[y], "residential"))
map->options |= DUNDI_FLAG_RESIDENTIAL;
else if (!strcasecmp(fields[y], "commercial"))
map->options |= DUNDI_FLAG_COMMERCIAL;
else if (!strcasecmp(fields[y], "mobile"))
map->options |= DUNDI_FLAG_MOBILE;
else if (!strcasecmp(fields[y], "nopartial"))
map->options |= DUNDI_FLAG_INTERNAL_NOPARTIAL;
else
ast_log(LOG_WARNING, "Don't know anything about option '%s'\n", fields[y]);
}
} else
ast_log(LOG_WARNING, "Expected at least %d arguments in map, but got only %d\n", 4, x);
} }
/* \note Called with the peers list already locked */ /* \note Called with the peers list already locked */

Loading…
Cancel
Save