Module: kamailio Branch: master Commit: 13f34f0effc936030baf82bbdd10285b98d6d790 URL: https://github.com/kamailio/kamailio/commit/13f34f0effc936030baf82bbdd10285b98d6d790
Author: Daniel-Constantin Mierla <mico...@gmail.com> Committer: Daniel-Constantin Mierla <mico...@gmail.com> Date: 2017-06-24T08:18:18+02:00 htable: removed useless mode param from ht_cell_value_add() - it was used only once with mode=1 --- Modified: src/modules/htable/ht_api.c Modified: src/modules/htable/ht_api.h Modified: src/modules/htable/ht_var.c --- Diff: https://github.com/kamailio/kamailio/commit/13f34f0effc936030baf82bbdd10285b98d6d790.diff Patch: https://github.com/kamailio/kamailio/commit/13f34f0effc936030baf82bbdd10285b98d6d790.patch --- diff --git a/src/modules/htable/ht_api.c b/src/modules/htable/ht_api.c index 03aee19a72..9d066eb999 100644 --- a/src/modules/htable/ht_api.c +++ b/src/modules/htable/ht_api.c @@ -641,8 +641,7 @@ int ht_del_cell(ht_t *ht, str *name) return 0; } -ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, - ht_cell_t *old) +ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, ht_cell_t *old) { unsigned int idx; unsigned int hid; @@ -661,7 +660,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(ht->htexpire>0) now = time(NULL); prev = NULL; - if(mode) ht_slot_lock(ht, idx); + ht_slot_lock(ht, idx); it = ht->entries[idx].first; while(it!=NULL && it->cellid < hid) { @@ -683,7 +682,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, it->value.n = ht->initval.n; /* increment will be done below */ } else { - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return NULL; } } @@ -691,7 +690,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(it->flags&AVP_VAL_STR) { /* string value cannot be incremented */ - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return NULL; } else { it->value.n += val; @@ -702,7 +701,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(old->msize>=it->msize) { memcpy(old, it, it->msize); - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return old; } } @@ -710,7 +709,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(cell!=NULL) memcpy(cell, it, it->msize); - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return cell; } } @@ -720,7 +719,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, /* add val if htable has an integer init value */ if(ht->flags!=PV_VAL_INT) { - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return NULL; } isval.n = ht->initval.n + val; @@ -728,7 +727,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(it == NULL) { LM_ERR("cannot create new cell.\n"); - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return NULL; } it->expire = now + ht->htexpire; @@ -753,7 +752,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(old->msize>=it->msize) { memcpy(old, it, it->msize); - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return old; } } @@ -761,7 +760,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(cell!=NULL) memcpy(cell, it, it->msize); - if(mode) ht_slot_unlock(ht, idx); + ht_slot_unlock(ht, idx); return cell; } diff --git a/src/modules/htable/ht_api.h b/src/modules/htable/ht_api.h index d64b68ac95..c9bbd68c94 100644 --- a/src/modules/htable/ht_api.h +++ b/src/modules/htable/ht_api.h @@ -91,8 +91,7 @@ int ht_init_tables(void); int ht_destroy(void); int ht_set_cell(ht_t *ht, str *name, int type, int_str *val, int mode); int ht_del_cell(ht_t *ht, str *name); -ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, - ht_cell_t *old); +ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, ht_cell_t *old); int ht_dbg(void); ht_cell_t* ht_cell_pkg_copy(ht_t *ht, str *name, ht_cell_t *old); diff --git a/src/modules/htable/ht_var.c b/src/modules/htable/ht_var.c index 2713f41ddd..9ef26a9e7e 100644 --- a/src/modules/htable/ht_var.c +++ b/src/modules/htable/ht_var.c @@ -331,7 +331,7 @@ int pv_get_ht_add(struct sip_msg *msg, pv_param_t *param, LM_ERR("cannot get $sht name\n"); return -1; } - htc = ht_cell_value_add(hpv->ht, &htname, val, 1, _htc_local); + htc = ht_cell_value_add(hpv->ht, &htname, val, _htc_local); if(_htc_local!=htc) { ht_cell_pkg_free(_htc_local); _______________________________________________ Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-dev