Spacing changes only

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@181027 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.6.2
Tilghman Lesher 17 years ago
parent 1322112da0
commit ac7e490b94

@ -1568,36 +1568,41 @@ static struct ast_exten *trie_find_next_match(struct match_char *node)
struct match_char *m4;
struct ast_exten *e3;
if (node && node->x[0] == '.' && !node->x[1]) /* dot and ! will ALWAYS be next match in a matchmore */
if (node && node->x[0] == '.' && !node->x[1]) { /* dot and ! will ALWAYS be next match in a matchmore */
return node->exten;
}
if (node && node->x[0] == '!' && !node->x[1])
if (node && node->x[0] == '!' && !node->x[1]) {
return node->exten;
}
if (!node || !node->next_char)
if (!node || !node->next_char) {
return NULL;
}
m3 = node->next_char;
if (m3->exten)
if (m3->exten) {
return m3->exten;
for(m4=m3->alt_char; m4; m4 = m4->alt_char) {
if (m4->exten)
}
for (m4 = m3->alt_char; m4; m4 = m4->alt_char) {
if (m4->exten) {
return m4->exten;
}
for(m4=m3; m4; m4 = m4->alt_char) {
}
for (m4 = m3; m4; m4 = m4->alt_char) {
e3 = trie_find_next_match(m3);
if (e3)
if (e3) {
return e3;
}
}
return NULL;
}
#ifdef DEBUG_THIS
static char *action2str(enum ext_match_t action)
{
switch(action)
{
switch (action) {
case E_MATCH:
return "MATCH";
case E_CANMATCH:
@ -1625,13 +1630,13 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
else
ast_log(LOG_NOTICE,"new_find_extension called with %s on (sub)tree NULL action=%s\n", str, action2str(action));
#endif
for (p=tree; p; p=p->alt_char) {
for (p = tree; p; p = p->alt_char) {
if (p->x[0] == 'N') {
if (p->x[1] == 0 && *str >= '2' && *str <= '9' ) {
#define NEW_MATCHER_CHK_MATCH \
if (p->exten && !(*(str+1))) { /* if a shorter pattern matches along the way, might as well report it */ \
if (p->exten && !(*(str + 1))) { /* if a shorter pattern matches along the way, might as well report it */ \
if (action == E_MATCH || action == E_SPAWN || action == E_FINDLABEL) { /* if in CANMATCH/MATCHMORE, don't let matches get in the way */ \
update_scoreboard(score, length+1, spec+p->specificity, p->exten,0,callerid, p->deleted, p); \
update_scoreboard(score, length + 1, spec + p->specificity, p->exten, 0, callerid, p->deleted, p); \
if (!p->deleted) { \
if (action == E_FINDLABEL) { \
if (ast_hashtab_lookup(score->exten->peer_label_table, &pattern)) { \
@ -1647,27 +1652,27 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
}
#define NEW_MATCHER_RECURSE \
if (p->next_char && ( *(str+1) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0) \
if (p->next_char && ( *(str + 1) || (p->next_char->x[0] == '/' && p->next_char->x[1] == 0) \
|| p->next_char->x[0] == '!')) { \
if (*(str+1) || p->next_char->x[0] == '!') { \
new_find_extension(str+1, score, p->next_char, length+1, spec+p->specificity, callerid, label, action); \
if (*(str + 1) || p->next_char->x[0] == '!') { \
new_find_extension(str + 1, score, p->next_char, length + 1, spec+p->specificity, callerid, label, action); \
if (score->exten) { \
ast_debug(4,"returning an exact match-- %s\n", score->exten->exten); \
ast_debug(4, "returning an exact match-- %s\n", score->exten->exten); \
return; /* the first match is all we need */ \
} \
} else { \
new_find_extension("/", score, p->next_char, length+1, spec+p->specificity, callerid, label, action); \
new_find_extension("/", score, p->next_char, length + 1, spec+p->specificity, callerid, label, action); \
if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) { \
ast_debug(4,"returning a (can/more) match--- %s\n", score->exten ? score->exten->exten : \
"NULL"); \
return; /* the first match is all we need */ \
} \
} \
} else if (p->next_char && !*(str+1)) { \
} else if (p->next_char && !*(str + 1)) { \
score->canmatch = 1; \
score->canmatch_exten = get_canmatch_exten(p); \
if (action == E_CANMATCH || action == E_MATCHMORE) { \
ast_debug(4,"returning a canmatch/matchmore--- str=%s\n", str); \
ast_debug(4, "returning a canmatch/matchmore--- str=%s\n", str); \
return; \
} \
}
@ -1703,7 +1708,7 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
if (p->next_char && p->next_char->x[0] == '/' && p->next_char->x[1] == 0) {
new_find_extension("/", score, p->next_char, length+i, spec+(p->specificity*i), callerid, label, action);
if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {
ast_debug(4,"return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set--- %s\n", score->exten ? score->exten->exten : "NULL");
ast_debug(4, "return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set--- %s\n", score->exten ? score->exten->exten : "NULL");
return; /* the first match is all we need */
}
}
@ -1716,14 +1721,14 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
i++;
}
if (p->exten && *str2 != '/') {
update_scoreboard(score, length+1, spec+(p->specificity*i), p->exten, '!', callerid, p->deleted, p);
update_scoreboard(score, length + 1, spec+(p->specificity * i), p->exten, '!', callerid, p->deleted, p);
if (score->exten) {
ast_debug(4,"return because scoreboard has a '!' match--- %s\n", score->exten->exten);
ast_debug(4, "return because scoreboard has a '!' match--- %s\n", score->exten->exten);
return; /* the first match is all we need */
}
}
if (p->next_char && p->next_char->x[0] == '/' && p->next_char->x[1] == 0) {
new_find_extension("/", score, p->next_char, length+i, spec+(p->specificity*i), callerid, label, action);
new_find_extension("/", score, p->next_char, length + i, spec + (p->specificity * i), callerid, label, action);
if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {
ast_debug(4,"return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/' and '!'--- %s\n", score->exten ? score->exten->exten : "NULL");
return; /* the first match is all we need */
@ -1734,7 +1739,7 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
if (p->next_char && callerid && *callerid) {
new_find_extension(callerid, score, p->next_char, length+1, spec, callerid, label, action);
if (score->exten || ((action == E_CANMATCH || action == E_MATCHMORE) && score->canmatch)) {
ast_debug(4,"return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/'--- %s\n", score->exten ? score->exten->exten : "NULL");
ast_debug(4, "return because scoreboard has exact match OR CANMATCH/MATCHMORE & canmatch set with '/'--- %s\n", score->exten ? score->exten->exten : "NULL");
return; /* the first match is all we need */
}
}
@ -1744,7 +1749,7 @@ static void new_find_extension(const char *str, struct scoreboard *score, struct
NEW_MATCHER_RECURSE;
}
}
ast_debug(4,"return at end of func\n");
ast_debug(4, "return at end of func\n");
}
/* the algorithm for forming the extension pattern tree is also a bit simple; you
@ -1768,13 +1773,15 @@ static struct match_char *already_in_tree(struct match_char *current, char *pat)
{
struct match_char *t;
if (!current)
if (!current) {
return 0;
}
for (t = current; t; t = t->alt_char) {
if (!strcmp(pat, t->x)) /* uh, we may want to sort exploded [] contents to make matching easy */
if (!strcmp(pat, t->x)) { /* uh, we may want to sort exploded [] contents to make matching easy */
return t;
}
}
return 0;
}
@ -1792,13 +1799,13 @@ static void insert_in_next_chars_alt_char_list(struct match_char **parent_ptr, s
if (!(*parent_ptr)) {
*parent_ptr = node;
} else {
if ((*parent_ptr)->specificity > node->specificity){
if ((*parent_ptr)->specificity > node->specificity) {
/* insert at head */
node->alt_char = (*parent_ptr);
*parent_ptr = node;
} else {
lcurr = *parent_ptr;
for (curr=(*parent_ptr)->alt_char; curr; curr = curr->alt_char) {
for (curr = (*parent_ptr)->alt_char; curr; curr = curr->alt_char) {
if (curr->specificity > node->specificity) {
node->alt_char = curr;
lcurr->alt_char = node;
@ -1819,8 +1826,9 @@ static struct match_char *add_pattern_node(struct ast_context *con, struct match
{
struct match_char *m;
if (!(m = ast_calloc(1, sizeof(*m))))
if (!(m = ast_calloc(1, sizeof(*m)))) {
return NULL;
}
if (!(m->x = ast_strdup(pattern))) {
ast_free(m);
@ -1871,14 +1879,14 @@ static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, str
ast_copy_string(extenbuf, e1->exten, sizeof(extenbuf));
if (e1->matchcid && l1 <= sizeof(extenbuf)) {
strcat(extenbuf,"/");
strcat(extenbuf,e1->cidmatch);
strcat(extenbuf, "/");
strcat(extenbuf, e1->cidmatch);
} else if (l1 > sizeof(extenbuf)) {
ast_log(LOG_ERROR,"The pattern %s/%s is too big to deal with: it will be ignored! Disaster!\n", e1->exten, e1->cidmatch);
ast_log(LOG_ERROR, "The pattern %s/%s is too big to deal with: it will be ignored! Disaster!\n", e1->exten, e1->cidmatch);
return 0;
}
#ifdef NEED_DEBUG
ast_log(LOG_DEBUG,"Adding exten %s%c%s to tree\n", s1, e1->matchcid? '/':' ', e1->matchcid? e1->cidmatch : "");
ast_log(LOG_DEBUG, "Adding exten %s%c%s to tree\n", s1, e1->matchcid ? '/' : ' ', e1->matchcid ? e1->cidmatch : "");
#endif
m1 = con->pattern_tree; /* each pattern starts over at the root of the pattern tree */
m0 = &con->pattern_tree;
@ -1893,24 +1901,24 @@ static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, str
char *s2 = buf;
buf[0] = 0;
s1++; /* get past the '[' */
while (*s1 != ']' && *(s1-1) != '\\' ) {
while (*s1 != ']' && *(s1 - 1) != '\\' ) {
if (*s1 == '\\') {
if (*(s1+1) == ']') {
if (*(s1 + 1) == ']') {
*s2++ = ']';
s1++;s1++;
} else if (*(s1+1) == '\\') {
s1++; s1++;
} else if (*(s1 + 1) == '\\') {
*s2++ = '\\';
s1++;s1++;
} else if (*(s1+1) == '-') {
s1++; s1++;
} else if (*(s1 + 1) == '-') {
*s2++ = '-';
s1++; s1++;
} else if (*(s1+1) == '[') {
} else if (*(s1 + 1) == '[') {
*s2++ = '[';
s1++; s1++;
}
} else if (*s1 == '-') { /* remember to add some error checking to all this! */
char s3 = *(s1-1);
char s4 = *(s1+1);
char s3 = *(s1 - 1);
char s4 = *(s1 + 1);
for (s3++; s3 <= s4; s3++) {
*s2++ = s3;
}
@ -1949,9 +1957,9 @@ static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, str
specif = 1;
}
m2 = 0;
if (already && (m2=already_in_tree(m1,buf)) && m2->next_char) {
if (!(*(s1+1))) { /* if this is the end of the pattern, but not the end of the tree, then mark this node with the exten...
a shorter pattern might win if the longer one doesn't match */
if (already && (m2 = already_in_tree(m1,buf)) && m2->next_char) {
if (!(*(s1 + 1))) { /* if this is the end of the pattern, but not the end of the tree, then mark this node with the exten...
* a shorter pattern might win if the longer one doesn't match */
m2->exten = e1;
m2->deleted = 0;
}
@ -1959,17 +1967,19 @@ static struct match_char *add_exten_to_pattern_tree(struct ast_context *con, str
m0 = &m2->next_char; /* m0 points to the ptr that points to m1 */
} else { /* not already OR not m2 OR nor m2->next_char */
if (m2) {
if (findonly)
if (findonly) {
return m2;
}
m1 = m2; /* while m0 stays the same */
} else {
if (findonly)
if (findonly) {
return m1;
}
m1 = add_pattern_node(con, m1, buf, pattern, already,specif, m0); /* m1 is the node just added */
m0 = &m1->next_char;
}
if (!(*(s1+1))) {
if (!(*(s1 + 1))) {
m1->deleted = 0;
m1->exten = e1;
}
@ -1994,11 +2004,12 @@ static void create_match_char_tree(struct ast_context *con)
numobjs, numbucks, biggest_bucket, resizes);
#endif
t1 = ast_hashtab_start_traversal(con->root_table);
while( (e1 = ast_hashtab_next(t1)) ) {
if (e1->exten)
while ((e1 = ast_hashtab_next(t1))) {
if (e1->exten) {
add_exten_to_pattern_tree(con, e1, 0);
else
ast_log(LOG_ERROR,"Attempt to create extension with no extension name.\n");
} else {
ast_log(LOG_ERROR, "Attempt to create extension with no extension name.\n");
}
}
ast_hashtab_end_traversal(t1);
}
@ -2016,8 +2027,9 @@ static void destroy_pattern_tree(struct match_char *pattern_tree) /* pattern tre
pattern_tree->next_char = 0;
}
pattern_tree->exten = 0; /* never hurts to make sure there's no pointers laying around */
if (pattern_tree->x)
if (pattern_tree->x) {
free(pattern_tree->x);
}
free(pattern_tree);
}
@ -2296,12 +2308,12 @@ static int _extension_match_core(const char *pattern, const char *data, enum ext
break;
case '.': /* Must match, even with more digits */
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"return (1) when '.' is matched\n");
ast_log(LOG_NOTICE, "return (1) when '.' is matched\n");
#endif
return 1;
case '!': /* Early match */
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"return (2) when '!' is matched\n");
ast_log(LOG_NOTICE, "return (2) when '!' is matched\n");
#endif
return 2;
case ' ':
@ -2311,18 +2323,17 @@ static int _extension_match_core(const char *pattern, const char *data, enum ext
default:
if (*data != *pattern) {
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"return (0) when *data(%c) != *pattern(%c)\n", *data, *pattern);
ast_log(LOG_NOTICE, "return (0) when *data(%c) != *pattern(%c)\n", *data, *pattern);
#endif
return 0;
}
}
data++;
pattern++;
}
if (*data) /* data longer than pattern, no match */ {
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"return (0) when data longer than pattern\n");
ast_log(LOG_NOTICE, "return (0) when data longer than pattern\n");
#endif
return 0;
}
@ -2333,17 +2344,17 @@ static int _extension_match_core(const char *pattern, const char *data, enum ext
*/
if (*pattern == '\0' || *pattern == '/') { /* exact match */
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"at end, return (%d) in 'exact match'\n", (mode==E_MATCHMORE) ? 0 : 1);
ast_log(LOG_NOTICE, "at end, return (%d) in 'exact match'\n", (mode==E_MATCHMORE) ? 0 : 1);
#endif
return (mode == E_MATCHMORE) ? 0 : 1; /* this is a failure for E_MATCHMORE */
} else if (*pattern == '!') { /* early match */
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"at end, return (2) when '!' is matched\n");
ast_log(LOG_NOTICE, "at end, return (2) when '!' is matched\n");
#endif
return 2;
} else { /* partial match */
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"at end, return (%d) which deps on E_MATCH\n", (mode == E_MATCH) ? 0 : 1);
ast_log(LOG_NOTICE, "at end, return (%d) which deps on E_MATCH\n", (mode == E_MATCH) ? 0 : 1);
#endif
return (mode == E_MATCH) ? 0 : 1; /* this is a failure for E_MATCH */
}
@ -2357,8 +2368,9 @@ static int extension_match_core(const char *pattern, const char *data, enum ext_
{
int i;
static int prof_id = -2; /* marker for 'unallocated' id */
if (prof_id == -2)
if (prof_id == -2) {
prof_id = ast_add_profile("ext_match", 0);
}
ast_mark(prof_id, 1);
i = _extension_match_core(pattern, data, mode);
ast_mark(prof_id, 0);
@ -2405,10 +2417,11 @@ struct ast_context *ast_context_find(const char *name)
tmp = ast_hashtab_lookup(contexts_table,&item);
} else {
while ( (tmp = ast_walk_contexts(tmp)) ) {
if (!name || !strcasecmp(name, tmp->name))
if (!name || !strcasecmp(name, tmp->name)) {
break;
}
}
}
ast_unlock_contexts();
return tmp;
}
@ -2424,8 +2437,9 @@ static int matchcid(const char *cidpattern, const char *callerid)
/* If the Caller*ID pattern is empty, then we're matching NO Caller*ID, so
failing to get a number should count as a match, otherwise not */
if (ast_strlen_zero(callerid))
if (ast_strlen_zero(callerid)) {
return ast_strlen_zero(cidpattern) ? 1 : 0;
}
return ast_extension_match(cidpattern, callerid);
}
@ -2447,7 +2461,7 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
pattern.label = label;
pattern.priority = priority;
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"Looking for cont/ext/prio/label/action = %s/%s/%d/%s/%d\n", context, exten, priority, label, (int)action);
ast_log(LOG_NOTICE, "Looking for cont/ext/prio/label/action = %s/%s/%d/%s/%d\n", context, exten, priority, label, (int) action);
#endif
/* Initialize status if appropriate */
@ -2467,9 +2481,9 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
return NULL;
}
if (bypass) /* bypass means we only look there */
if (bypass) { /* bypass means we only look there */
tmp = bypass;
else { /* look in contexts */
} else { /* look in contexts */
struct fake_context item;
ast_copy_string(item.name, context, sizeof(item.name));
@ -2478,13 +2492,14 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
#ifdef NOTNOW
tmp = NULL;
while ((tmp = ast_walk_contexts(tmp)) ) {
if (!strcmp(tmp->name, context))
if (!strcmp(tmp->name, context)) {
break;
}
}
#endif
if (!tmp)
if (!tmp) {
return NULL;
}
}
if (q->status < STATUS_NO_EXTENSION)
@ -2496,16 +2511,15 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
score.total_specificity = 0;
score.exten = 0;
score.total_length = 0;
if (!tmp->pattern_tree && tmp->root_table)
{
if (!tmp->pattern_tree && tmp->root_table) {
create_match_char_tree(tmp);
#ifdef NEED_DEBUG
ast_log(LOG_DEBUG,"Tree Created in context %s:\n", context);
ast_log(LOG_DEBUG, "Tree Created in context %s:\n", context);
log_match_char_tree(tmp->pattern_tree," ");
#endif
}
#ifdef NEED_DEBUG
ast_log(LOG_NOTICE,"The Trie we are searching in:\n");
ast_log(LOG_NOTICE, "The Trie we are searching in:\n");
log_match_char_tree(tmp->pattern_tree, ":: ");
#endif
@ -2612,7 +2626,7 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
return z;
}
#ifdef NEED_DEBUG_HERE
ast_log(LOG_NOTICE,"Returning CANMATCH/MATCHMORE NULL (no next_match)\n");
ast_log(LOG_NOTICE, "Returning CANMATCH/MATCHMORE NULL (no next_match)\n");
#endif
return NULL; /* according to the code, complete matches are null matches in MATCHMORE mode */
}
@ -2686,7 +2700,6 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
}
}
/* Check alternative switches */
AST_LIST_TRAVERSE(&tmp->alts, sw, list) {
struct ast_switch *asw = pbx_findswitch(sw->name);
@ -2697,8 +2710,8 @@ struct ast_exten *pbx_find_extension(struct ast_channel *chan,
ast_log(LOG_WARNING, "No such switch '%s'\n", sw->name);
continue;
}
/* Substitute variables now */
/* Substitute variables now */
if (sw->eval) {
if (!(tmpdata = ast_str_thread_get(&switch_data, 512))) {
ast_log(LOG_WARNING, "Can't evaluate switch?!");
@ -3148,7 +3161,7 @@ static char *handle_show_function(struct ast_cli_entry *e, int cmd, struct ast_c
term_color(seealso, S_OR(acf->seealso, "Not available"), COLOR_CYAN, 0, seealso_size);
}
ast_cli(a->fd,"%s%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n",
ast_cli(a->fd, "%s%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n\n%s%s\n",
infotitle, syntitle, synopsis, destitle, description,
stxtitle, syntax, argtitle, arguments, seealsotitle, seealso);
@ -3179,8 +3192,9 @@ int ast_custom_function_unregister(struct ast_custom_function *acf)
{
struct ast_custom_function *cur;
if (!acf)
if (!acf) {
return -1;
}
AST_RWLIST_WRLOCK(&acf_root);
if ((cur = AST_RWLIST_REMOVE(&acf_root, acf, acflist))) {
@ -3300,16 +3314,17 @@ static char *func_args(char *function)
{
char *args = strchr(function, '(');
if (!args)
if (!args) {
ast_log(LOG_WARNING, "Function doesn't contain parentheses. Assuming null argument.\n");
else {
} else {
char *p;
*args++ = '\0';
if ((p = strrchr(args, ')')) )
if ((p = strrchr(args, ')'))) {
*p = '\0';
else
} else {
ast_log(LOG_WARNING, "Can't find trailing parenthesis?\n");
}
}
return args;
}
@ -3785,9 +3800,9 @@ int ast_extension_state(struct ast_channel *c, const char *context, const char *
{
struct ast_exten *e;
e = ast_hint_extension(c, context, exten); /* Do we have a hint for this extension ? */
if (!e)
if (!(e = ast_hint_extension(c, context, exten))) { /* Do we have a hint for this extension ? */
return -1; /* No hint, return -1 */
}
return ast_extension_state2(e); /* Check all devices in the hint */
}
@ -3809,17 +3824,20 @@ static int handle_statechange(void *datap)
ast_copy_string(buf, ast_get_extension_app(hint->exten), sizeof(buf));
while ( (cur = strsep(&parse, "&")) ) {
if (!strcasecmp(cur, sc->dev))
if (!strcasecmp(cur, sc->dev)) {
break;
}
if (!cur)
}
if (!cur) {
continue;
}
/* Get device state for this hint */
state = ast_extension_state2(hint->exten);
if ((state == -1) || (state == hint->laststate))
if ((state == -1) || (state == hint->laststate)) {
continue;
}
/* Device state changed since last check - notify the watchers */
@ -4441,7 +4459,7 @@ static int increase_call_count(const struct ast_channel *c)
/* make sure that the free system memory is above the configured low watermark
* convert the amount of freeram from mem_units to MB */
curfreemem = sys_info.freeram / sys_info.mem_unit;
curfreemem /= 1024*1024;
curfreemem /= 1024 * 1024;
if (curfreemem < option_minmemfree) {
ast_log(LOG_WARNING, "Available system memory (~%ldMB) is below the configured low watermark (%ldMB)\n", curfreemem, option_minmemfree);
failed = -1;
@ -4805,7 +4823,6 @@ int ast_context_remove_extension_callerid2(struct ast_context *con, const char *
if (!exten2)
ast_log(LOG_ERROR,"Trying to delete the exten %s from context %s, but could not remove from the root_table\n", extension, con->name);
if (con->pattern_tree) {
struct match_char *x = add_exten_to_pattern_tree(con, exten, 1);
if (x->exten) { /* this test for safety purposes */
@ -4959,8 +4976,9 @@ int ast_context_lockmacro(const char *context)
ast_unlock_contexts();
/* if we found context, lock macrolock */
if (ret == 0)
if (ret == 0) {
ret = ast_mutex_lock(&c->macrolock);
}
return ret;
}
@ -4996,8 +5014,9 @@ int ast_context_unlockmacro(const char *context)
ast_unlock_contexts();
/* if we found context, unlock macrolock */
if (ret == 0)
if (ret == 0) {
ret = ast_mutex_unlock(&c->macrolock);
}
return ret;
}

Loading…
Cancel
Save