|
@@ -49,7 +49,7 @@ extern int _mt_ignore_duplicates;
|
|
|
extern int _mt_allow_duplicates;
|
|
|
|
|
|
/** structures containing prefix-value pairs */
|
|
|
-static m_tree_t **_ptree = NULL;
|
|
|
+static m_tree_t **_ptree = NULL;
|
|
|
|
|
|
/* quick transaltion table */
|
|
|
unsigned char _mt_char_table[256];
|
|
@@ -210,7 +210,7 @@ int mt_add_to_tree(m_tree_t *pt, str *sp, str *svalue)
|
|
|
}
|
|
|
|
|
|
LM_DBG("adding to tree <%.*s> of type <%d>\n", pt->tname.len,
|
|
|
- pt->tname.s, pt->type);
|
|
|
+ pt->tname.s, pt->type);
|
|
|
|
|
|
if ((pt->type == MT_TREE_IVAL) && (str2sint(svalue, &ivalue) != 0)) {
|
|
|
LM_ERR("bad integer string <%.*s>\n", svalue->len, svalue->s);
|
|
@@ -236,7 +236,7 @@ int mt_add_to_tree(m_tree_t *pt, str *sp, str *svalue)
|
|
|
{
|
|
|
LM_ERR("invalid char %d in prefix [%c (0x%x)]\n",
|
|
|
l, sp->s[l], sp->s[l]);
|
|
|
- return -1;
|
|
|
+ return -1;
|
|
|
}
|
|
|
itn = itn0[_mt_char_table[(unsigned int)sp->s[l]]].child;
|
|
|
|
|
@@ -255,12 +255,12 @@ int mt_add_to_tree(m_tree_t *pt, str *sp, str *svalue)
|
|
|
pt->memsize += MT_NODE_SIZE*sizeof(mt_node_t);
|
|
|
itn0[_mt_char_table[(unsigned int)sp->s[l]]].child = itn;
|
|
|
}
|
|
|
- l++;
|
|
|
+ l++;
|
|
|
if(_mt_char_table[(unsigned int)sp->s[l]]==255)
|
|
|
{
|
|
|
LM_ERR("invalid char %d in prefix [%c (0x%x)]\n",
|
|
|
l, sp->s[l], sp->s[l]);
|
|
|
- return -1;
|
|
|
+ return -1;
|
|
|
}
|
|
|
itn0 = itn;
|
|
|
itn = itn0[_mt_char_table[(unsigned int)sp->s[l]]].child;
|
|
@@ -376,7 +376,7 @@ is_t* mt_get_tvalue(m_tree_t *pt, str *tomatch, int *len)
|
|
|
}
|
|
|
|
|
|
itn = itn[_mt_char_table[(unsigned int)tomatch->s[l]]].child;
|
|
|
- l++;
|
|
|
+ l++;
|
|
|
}
|
|
|
|
|
|
*len = l;
|
|
@@ -386,7 +386,7 @@ is_t* mt_get_tvalue(m_tree_t *pt, str *tomatch, int *len)
|
|
|
|
|
|
int mt_add_tvalues(struct sip_msg *msg, m_tree_t *pt, str *tomatch)
|
|
|
{
|
|
|
- int l, n;
|
|
|
+ int l, n;
|
|
|
mt_node_t *itn;
|
|
|
int_str val, values_avp_name;
|
|
|
unsigned short values_name_type;
|
|
@@ -434,13 +434,13 @@ int mt_add_tvalues(struct sip_msg *msg, m_tree_t *pt, str *tomatch)
|
|
|
}
|
|
|
|
|
|
itn = itn[_mt_char_table[(unsigned int)tomatch->s[l]]].child;
|
|
|
- l++;
|
|
|
+ l++;
|
|
|
}
|
|
|
|
|
|
if (n > 0)
|
|
|
- return 0;
|
|
|
+ return 0;
|
|
|
else
|
|
|
- return -1;
|
|
|
+ return -1;
|
|
|
}
|
|
|
|
|
|
int mt_match_prefix(struct sip_msg *msg, m_tree_t *it,
|
|
@@ -471,7 +471,7 @@ int mt_match_prefix(struct sip_msg *msg, m_tree_t *it,
|
|
|
l = len = 0;
|
|
|
n = 0;
|
|
|
if ((it->type==MT_TREE_SVAL) || (it->type==MT_TREE_IVAL)) {
|
|
|
- if (mode == 2)
|
|
|
+ if (mode == 2)
|
|
|
return mt_add_tvalues(msg, it, tomatch);
|
|
|
tvalue = mt_get_tvalue(it, tomatch, &k);
|
|
|
if (tvalue == NULL) {
|
|
@@ -543,7 +543,7 @@ int mt_match_prefix(struct sip_msg *msg, m_tree_t *it,
|
|
|
break;
|
|
|
|
|
|
itn = itn[_mt_char_table[(unsigned int)tomatch->s[l]]].child;
|
|
|
- l++;
|
|
|
+ l++;
|
|
|
}
|
|
|
|
|
|
if(n==0)
|
|
@@ -627,7 +627,7 @@ void mt_free_tree(m_tree_t *pt)
|
|
|
if(pt == NULL)
|
|
|
return;
|
|
|
|
|
|
- if(pt->head!=NULL)
|
|
|
+ if(pt->head!=NULL)
|
|
|
mt_free_node(pt->head, pt->type);
|
|
|
if(pt->next!=NULL)
|
|
|
mt_free_tree(pt->next);
|
|
@@ -818,7 +818,7 @@ int mt_table_spec(char* val)
|
|
|
LM_ERR("unknown multi value <%d>\n", tmp.multi);
|
|
|
goto error;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/* check for same tree */
|
|
|
if(_ptree == 0)
|
|
|
{
|
|
@@ -835,7 +835,7 @@ int mt_table_spec(char* val)
|
|
|
prev = NULL;
|
|
|
/* search the it position before which to insert new tvalue */
|
|
|
while(it!=NULL && str_strcmp(&it->tname, &tmp.tname)<0)
|
|
|
- {
|
|
|
+ {
|
|
|
prev = it;
|
|
|
it = it->next;
|
|
|
}
|
|
@@ -844,7 +844,7 @@ int mt_table_spec(char* val)
|
|
|
if(it!=NULL && str_strcmp(&it->tname, &tmp.tname)==0)
|
|
|
{
|
|
|
LM_ERR("duplicate tree with name [%s]\n", tmp.tname.s);
|
|
|
- goto error;
|
|
|
+ goto error;
|
|
|
}
|
|
|
/* add new tname*/
|
|
|
if(it==NULL || str_strcmp(&it->tname, &tmp.tname)>0)
|
|
@@ -852,12 +852,12 @@ int mt_table_spec(char* val)
|
|
|
LM_DBG("adding new tname [%s]\n", tmp.tname.s);
|
|
|
|
|
|
ndl = mt_init_tree(&tmp.tname, &tmp.dbtable, &tmp.scols[0], tmp.type,
|
|
|
- tmp.multi);
|
|
|
+ tmp.multi);
|
|
|
if(ndl==NULL)
|
|
|
{
|
|
|
LM_ERR("cannot init the tree [%.*s]\n",
|
|
|
tmp.tname.len, tmp.tname.s);
|
|
|
- goto error;
|
|
|
+ goto error;
|
|
|
}
|
|
|
|
|
|
ndl->next = it;
|