Module: sip-router Branch: 4.2 Commit: 4bd289f1d893fd36c4fe508f34c0d2a58901d119 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=4bd289f1...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Thu Nov 6 18:43:50 2014 +0100
htable: use mode everywhere to control the locks for add operation
(cherry picked from commit c7ff8a88e773e8d25958f86d178f05ee10fd0410)
---
modules/htable/ht_api.c | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/modules/htable/ht_api.c b/modules/htable/ht_api.c index 13d373d..55f1f3a 100644 --- a/modules/htable/ht_api.c +++ b/modules/htable/ht_api.c @@ -606,7 +606,7 @@ ht_cell_t* ht_cell_value_add(ht_t *ht, str *name, int val, int mode, if(it->next) it->next->prev = it->prev; ht->entries[idx].esize--; - lock_release(&ht->entries[idx].lock); + if(mode) lock_release(&ht->entries[idx].lock); ht_cell_free(it); return NULL; } @@ -625,7 +625,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); - lock_release(&ht->entries[idx].lock); + if(mode) lock_release(&ht->entries[idx].lock); return old; } } @@ -673,7 +673,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); - lock_release(&ht->entries[idx].lock); + if(mode) lock_release(&ht->entries[idx].lock); return old; } }