Skip to content

Commit

Permalink
htable: renamed the new functions to match on name or value of items
Browse files Browse the repository at this point in the history
  • Loading branch information
miconda committed Jul 31, 2019
1 parent f887c81 commit 9c595cb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/modules/htable/ht_api.c
Expand Up @@ -1337,7 +1337,7 @@ int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op)
return 0;
}

int ht_has_cell_op_str(str *sre, ht_t *ht, int mode, int op)
int ht_match_cell_op_str(str *sre, ht_t *ht, int mode, int op)
{
ht_cell_t *it;
str sm;
Expand Down
2 changes: 1 addition & 1 deletion src/modules/htable/ht_api.h
Expand Up @@ -122,7 +122,7 @@ int ht_reset_content(ht_t *ht);
#define HT_RM_OP_SW 3
#define HT_RM_OP_RE 4
int ht_rm_cell_op(str *sre, ht_t *ht, int mode, int op);
int ht_has_cell_op_str(str *sre, ht_t *ht, int mode, int op);
int ht_match_cell_op_str(str *sre, ht_t *ht, int mode, int op);

void ht_iterator_init(void);
int ht_iterator_start(str *iname, str *hname);
Expand Down
40 changes: 20 additions & 20 deletions src/modules/htable/htable.c
Expand Up @@ -72,8 +72,8 @@ static int ht_rm_name_re(struct sip_msg* msg, char* key, char* foo);
static int ht_rm_value_re(struct sip_msg* msg, char* key, char* foo);
static int w_ht_rm_name(struct sip_msg* msg, char* hname, char* op, char *val);
static int w_ht_rm_value(struct sip_msg* msg, char* hname, char* op, char *val);
static int w_ht_has_name(struct sip_msg* msg, char* hname, char* op, char *val);
static int w_ht_has_str_value(struct sip_msg* msg, char* hname, char* op, char *val);
static int w_ht_match_name(struct sip_msg* msg, char* hname, char* op, char *val);
static int w_ht_match_str_value(struct sip_msg* msg, char* hname, char* op, char *val);
static int w_ht_slot_lock(struct sip_msg* msg, char* key, char* foo);
static int w_ht_slot_unlock(struct sip_msg* msg, char* key, char* foo);
static int ht_reset(struct sip_msg* msg, char* htname, char* foo);
Expand Down Expand Up @@ -120,9 +120,9 @@ static cmd_export_t cmds[]={
ANY_ROUTE},
{"sht_rm_value", (cmd_function)w_ht_rm_value, 3, fixup_spve_all, 0,
ANY_ROUTE},
{"sht_has_name", (cmd_function)w_ht_has_name, 3, fixup_spve_all, 0,
{"sht_match_name", (cmd_function)w_ht_match_name, 3, fixup_spve_all, 0,
ANY_ROUTE},
{"sht_has_str_value", (cmd_function)w_ht_has_str_value, 3, fixup_spve_all, 0,
{"sht_match_str_value", (cmd_function)w_ht_match_str_value, 3, fixup_spve_all, 0,
ANY_ROUTE},
{"sht_lock", (cmd_function)w_ht_slot_lock, 1, fixup_ht_key, 0,
ANY_ROUTE},
Expand Down Expand Up @@ -583,7 +583,7 @@ static int w_ht_rm(sip_msg_t* msg, char* htname, char* itname)
return ki_ht_rm(msg, &shtname, &sitname);
}

static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
static int ht_match_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
int mkey)
{
ht_t *ht;
Expand All @@ -609,7 +609,7 @@ static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
LM_WARN("unsupported match operator: %.*s\n", op->len, op->s);
return -1;
}
if(ht_has_cell_op_str(val, ht, mkey, vop)<0) {
if(ht_match_cell_op_str(val, ht, mkey, vop)<0) {
return -1;
}
return 1;
Expand All @@ -619,7 +619,7 @@ static int ht_has_str_items(sip_msg_t* msg, str* hname, str* op, str *val,
}
}

static int w_ht_has_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
static int w_ht_match_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
int mkey)
{
str sname;
Expand All @@ -639,28 +639,28 @@ static int w_ht_has_str_items(sip_msg_t* msg, char* hname, char* op, char *val,
return -1;
}

return ht_has_str_items(msg, &sname, &sop, &sval, mkey);
return ht_match_str_items(msg, &sname, &sop, &sval, mkey);
}

static int w_ht_has_name(sip_msg_t* msg, char* hname, char* op, char *val)
static int w_ht_match_name(sip_msg_t* msg, char* hname, char* op, char *val)
{
return w_ht_has_str_items(msg, hname, op, val, 0);
return w_ht_match_str_items(msg, hname, op, val, 0);
}

static int w_ht_has_str_value(sip_msg_t* msg, char* hname, char* op, char *val)
static int w_ht_match_str_value(sip_msg_t* msg, char* hname, char* op, char *val)
{
return w_ht_has_str_items(msg, hname, op, val, 1);
return w_ht_match_str_items(msg, hname, op, val, 1);
}

static int ki_ht_has_name(sip_msg_t* msg, str* sname, str* sop, str *sval)
static int ki_ht_match_name(sip_msg_t* msg, str* sname, str* sop, str *sval)
{
return ht_has_str_items(msg, sname, sop, sval, 0);
return ht_match_str_items(msg, sname, sop, sval, 0);

}

static int ki_ht_has_str_value(sip_msg_t* msg, str* sname, str* sop, str *sval)
static int ki_ht_match_str_value(sip_msg_t* msg, str* sname, str* sop, str *sval)
{
return ht_has_str_items(msg, sname, sop, sval, 1);
return ht_match_str_items(msg, sname, sop, sval, 1);
}

static int ht_reset_by_name(str *hname)
Expand Down Expand Up @@ -1761,13 +1761,13 @@ static sr_kemi_t sr_kemi_htable_exports[] = {
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("htable"), str_init("sht_has_name"),
SR_KEMIP_INT, ki_ht_has_name,
{ str_init("htable"), str_init("sht_match_name"),
SR_KEMIP_INT, ki_ht_match_name,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
{ str_init("htable"), str_init("sht_has_str_value"),
SR_KEMIP_INT, ki_ht_has_str_value,
{ str_init("htable"), str_init("sht_match_str_value"),
SR_KEMIP_INT, ki_ht_match_str_value,
{ SR_KEMIP_STR, SR_KEMIP_STR, SR_KEMIP_STR,
SR_KEMIP_NONE, SR_KEMIP_NONE, SR_KEMIP_NONE }
},
Expand Down

0 comments on commit 9c595cb

Please sign in to comment.