Skip to content

Commit

Permalink
Use core_hash(x, NULL, y), not core_hash(x, 0, y).
Browse files Browse the repository at this point in the history
  • Loading branch information
sobomax committed Jan 25, 2021
1 parent 81523d0 commit 87b9286
Show file tree
Hide file tree
Showing 16 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion modules/b2b_entities/client.c
Expand Up @@ -161,7 +161,7 @@ str* client_new(client_info_t* ci,b2b_notify_t b2b_cback,
random_info.s = int2str(rand(), &random_info.len);

dlg->send_sock = ci->send_sock;
dlg->id = core_hash(&from_tag, random_info.s?&random_info:0, HASH_SIZE);
dlg->id = core_hash(&from_tag, random_info.s?&random_info:NULL, HASH_SIZE);

/* callid must have the special format */
dlg->db_flag = NO_UPDATEDB_FLAG;
Expand Down
10 changes: 5 additions & 5 deletions modules/cachedb_local/hash.c
Expand Up @@ -150,7 +150,7 @@ int _lcache_htable_insert(lcache_col_t *cache_col, str* attr, str* value,
if( expires != 0)
me->expires = get_ticks() + expires;

hash_code= core_hash( attr, 0, cache_col->size);
hash_code= core_hash( attr, NULL, cache_col->size);
lock_get(&cache_htable[hash_code].lock);

it = cache_htable[hash_code].entries;
Expand Down Expand Up @@ -224,7 +224,7 @@ int _lcache_htable_remove(lcache_col_t *cache_col, str* attr, int isrepl)

start_expire_timer(start,local_exec_threshold);

hash_code= core_hash( attr, 0, cache_col->size);
hash_code= core_hash( attr, NULL, cache_col->size);
lock_get(&cache_htable[hash_code].lock);

lcache_htable_remove_safe( *attr, &cache_htable[hash_code].entries);
Expand Down Expand Up @@ -265,7 +265,7 @@ int lcache_htable_add(cachedb_con *con,str *attr,int val,int expires,int *new_va

start_expire_timer(start,local_exec_threshold);

hash_code = core_hash(attr,0,cache_col->size);
hash_code = core_hash(attr, NULL,cache_col->size);
lock_get(&cache_htable[hash_code].lock);

it = cache_htable[hash_code].entries;
Expand Down Expand Up @@ -400,7 +400,7 @@ int lcache_htable_fetch(cachedb_con *con,str* attr, str* res)

start_expire_timer(start,local_exec_threshold);

hash_code= core_hash( attr, 0, cache_col->size);
hash_code= core_hash( attr, NULL, cache_col->size);
lock_get(&cache_htable[hash_code].lock);

it = cache_htable[hash_code].entries;
Expand Down Expand Up @@ -478,7 +478,7 @@ int lcache_htable_fetch_counter(cachedb_con* con,str* attr,int *val)

start_expire_timer(start,local_exec_threshold);

hash_code= core_hash( attr, 0, cache_col->size);
hash_code= core_hash( attr, NULL, cache_col->size);
lock_get(&cache_htable[hash_code].lock);

it = cache_htable[hash_code].entries;
Expand Down
2 changes: 1 addition & 1 deletion modules/dialog/dlg_hash.h
Expand Up @@ -211,7 +211,7 @@ extern int dlg_enable_stats;

struct dlg_cell *get_current_dialog();

#define dlg_hash(_callid) core_hash(_callid, 0, d_table->size)
#define dlg_hash(_callid) core_hash(_callid, NULL, d_table->size)

#define dlg_lock(_table, _entry) \
lock_set_get( (_table)->locks, (_entry)->lock_idx);
Expand Down
10 changes: 5 additions & 5 deletions modules/emergency/emergency_methods.c
Expand Up @@ -740,7 +740,7 @@ void reply_in_redirect( struct cell* t, int type, struct tmcb_params *params){
}
}

hash_code= core_hash(&reply->callid->body, 0, emet_size);
hash_code= core_hash(&reply->callid->body, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

if(insert_ehtable(call_htable,hash_code,call_cell)< 0){
Expand Down Expand Up @@ -902,7 +902,7 @@ static int failure(struct sip_msg *msg) {
memset(from_tag, 0, pfrom->tag_value.len + 1);
strncpy(from_tag, pfrom->tag_value.s, pfrom->tag_value.len);

hash_code= core_hash(&msg->callid->body, 0, emet_size);
hash_code= core_hash(&msg->callid->body, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

// find the cell with the callid from the list calls_cell
Expand Down Expand Up @@ -1367,7 +1367,7 @@ int create_call_cell(PARSED *parsed,struct sip_msg* msg, char* callidHeader, str

// insert calls_eme in call_htable hash with key source ip address

hash_code= core_hash(&msg->callid->body, 0, emet_size);
hash_code= core_hash(&msg->callid->body, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

if(insert_ehtable(call_htable, hash_code,call_cell)< 0){
Expand Down Expand Up @@ -1674,7 +1674,7 @@ int routing_ack(struct sip_msg *msg) {
strncpy(from_tag, pfrom->tag_value.s, pfrom->tag_value.len);
LM_DBG("PFROM_TAGIII: %s \n ", from_tag );

hash_code= core_hash(&msg->callid->body, 0, emet_size);
hash_code= core_hash(&msg->callid->body, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

LM_DBG(" ---TREATMENT ACK callid=%s \n", callidHeader);
Expand Down Expand Up @@ -1842,7 +1842,7 @@ int bye(struct sip_msg *msg, int dir) {

}

hash_code= core_hash(&msg->callid->body, 0, emet_size);
hash_code= core_hash(&msg->callid->body, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

// search call hash with hash_code, callidHeader and from/to_tag params
Expand Down
2 changes: 1 addition & 1 deletion modules/emergency/http_emergency.c
Expand Up @@ -75,7 +75,7 @@ int send_esct(struct sip_msg *msg, str callid_ori, str from_tag){
callid.s = callidHeader,
callid.len = strlen(callidHeader);

hash_code= core_hash(&callid, 0, emet_size);
hash_code= core_hash(&callid, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

info_call= search_ehtable(call_htable, callidHeader, ftag, hash_code, 1);
Expand Down
6 changes: 3 additions & 3 deletions modules/emergency/notifier_emergency.c
Expand Up @@ -118,7 +118,7 @@ struct sm_subscriber* build_notify_cell(struct sip_msg *msg, int expires){
fromtag_event.s = subs_fromtag;
fromtag_event.len = strlen(subs_fromtag);

hash_code= core_hash(&callid_event, 0, emet_size);
hash_code= core_hash(&callid_event, NULL, emet_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

// search call hash with hash_code, callidHeader and from/to_tag params
Expand Down Expand Up @@ -318,7 +318,7 @@ int treat_subscribe(struct sip_msg *msg) {
memcpy(notify_cell->dlg_id->local_tag.s, t->uas.local_totag.s, t->uas.local_totag.len);
LM_DBG("SUBS_FROM_TAG: %.*s \n ", notify_cell->dlg_id->local_tag.len, notify_cell->dlg_id->local_tag.s );

hash_code= core_hash(&notify_cell->call_dlg_id->callid, 0, subst_size);
hash_code= core_hash(&notify_cell->call_dlg_id->callid, NULL, subst_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);
LM_DBG("********************************************CALLID_STR%.*s\n", notify_cell->call_dlg_id->callid.len, notify_cell->call_dlg_id->callid.s);

Expand Down Expand Up @@ -431,7 +431,7 @@ void notif_cback_func(struct cell *t, int cb_type, struct tmcb_params *params){
if (params_notify->dlg_id->status == TERMINATED){

// delete subs_htable
hash_code= core_hash(&params_notify->call_dlg_id->callid, 0, subst_size);
hash_code= core_hash(&params_notify->call_dlg_id->callid, NULL, subst_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);
LM_DBG("********************************************CALLID_STR%.*s\n", params_notify->call_dlg_id->callid.len, params_notify->call_dlg_id->callid.s);

Expand Down
6 changes: 3 additions & 3 deletions modules/emergency/subscriber_emergency.c
Expand Up @@ -175,7 +175,7 @@ int create_subscriber_cell(struct sip_msg* reply, struct parms_cb* params_cb){

subs_cell->dlg_id->status = NOTIFY_WAIT;

hash_code= core_hash(&subs_cell->dlg_id->callid, 0, subst_size);
hash_code= core_hash(&subs_cell->dlg_id->callid, NULL, subst_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);


Expand Down Expand Up @@ -802,7 +802,7 @@ struct sm_subscriber* get_subs_cell(struct sip_msg *msg, str callid_event) {
LM_DBG("PTO: %.*s \n ", pto->uri.len, pto->uri.s );
LM_DBG("PTO_TAG: %.*s \n ", pto->tag_value.len, pto->tag_value.s );
LM_DBG("********************************************CALLID_STR%.*s\n", callid_event.len, callid_event.s);
hash_code= core_hash(&callid_event, 0, subst_size);
hash_code= core_hash(&callid_event, NULL, subst_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);


Expand Down Expand Up @@ -911,7 +911,7 @@ int treat_notify(struct sip_msg *msg) {
LM_ERR("error in send to esct\n");
}

hash_code= core_hash(&callid_event, 0, subst_size);
hash_code= core_hash(&callid_event, NULL, subst_size);
LM_DBG("********************************************HASH_CODE%d\n", hash_code);

delete_shtable(subs_htable, hash_code, cell_subs);
Expand Down
2 changes: 1 addition & 1 deletion modules/nathelper/sip_pinger.h
Expand Up @@ -243,7 +243,7 @@ build_branch(char *branch, int *size,
int reply_matching;

/* we want all contact pings from a contact in one bucket*/
hash_id = core_hash(curi, 0, 0) & (NH_TABLE_ENTRIES-1);
hash_id = core_hash(curi, NULL, 0) & (NH_TABLE_ENTRIES-1);

/* do we need to track and match the replies for this ping?
* We do if latency or remove on timeout flags are set for the contact */
Expand Down
2 changes: 1 addition & 1 deletion modules/permissions/hash.c
Expand Up @@ -36,7 +36,7 @@
#include <fnmatch.h>
//#include <regex.h>

#define perm_hash(_s) core_hash( &(_s), 0, PERM_HASH_SIZE)
#define perm_hash(_s) core_hash( &(_s), NULL, PERM_HASH_SIZE)

struct address_list** hash_create(void) {
struct address_list** ptr;
Expand Down
2 changes: 1 addition & 1 deletion modules/presence/hash.c
Expand Up @@ -581,7 +581,7 @@ int delete_phtable_query(str *pres_uri, int event, str* etag)
pres_entry_t* p;
unsigned int hash_code;

hash_code = core_hash(pres_uri, 0, phtable_size);
hash_code = core_hash(pres_uri, NULL, phtable_size);
lock_get(&pres_htable[hash_code].lock);
p = search_phtable_etag(pres_uri, event, etag, hash_code);
if(p == NULL)
Expand Down
2 changes: 1 addition & 1 deletion modules/presence_callinfo/sca_hash.c
Expand Up @@ -43,7 +43,7 @@ static struct sca_hash *sca_table = NULL;
#define sca_unlock(_entry) \
lock_set_release( sca_table->locks, sca_table->entries[_entry].lock_idx)

#define sca_hash(_line) core_hash(_line, 0, sca_table->size)
#define sca_hash(_line) core_hash(_line, NULL, sca_table->size)

int init_sca_hash(int size)
{
Expand Down
28 changes: 14 additions & 14 deletions modules/rate_cacher/rate_cacher.c
Expand Up @@ -602,7 +602,7 @@ static int reload_carrier_rate(str *carrierid, int rate_id)
currency.s = NULL;
rate_table.s = NULL;

bucket = core_hash(carrierid,0,carr_table->size);
bucket = core_hash(carrierid, NULL, carr_table->size);
entry = &(carr_table->entries[bucket]);

/* quickly lookup the carrier to see if it exists */
Expand Down Expand Up @@ -802,7 +802,7 @@ static int reload_client_rate(str *accountid, int wholesale,int rate_id,int star
rate_table.s = NULL;
currency.s = NULL;

bucket = core_hash(accountid,0,acc_table->size);
bucket = core_hash(accountid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

lock_bucket_write( entry->lock );
Expand Down Expand Up @@ -1164,7 +1164,7 @@ static mi_response_t * mi_get_carrier_price(const mi_params_t *params,struct mi_
&prefix.s, &prefix.len) < 0)
return init_mi_param_error();

bucket = core_hash(&carrier,0,carr_table->size);
bucket = core_hash(&carrier, NULL, carr_table->size);
entry = &(carr_table->entries[bucket]);

lock_bucket_read( entry->lock );
Expand Down Expand Up @@ -1253,7 +1253,7 @@ static int add_client(str *accountid, int safe)
struct account_entry *entry;
struct account_cell *it;

bucket = core_hash(accountid,0,acc_table->size);
bucket = core_hash(accountid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

if (safe)
Expand Down Expand Up @@ -1307,7 +1307,7 @@ static int add_carrier(str *carrier,int safe)
struct carrier_entry *entry;
struct carrier_cell *carr_cell,*it=NULL;

bucket = core_hash(carrier,0,carr_table->size);
bucket = core_hash(carrier, NULL, carr_table->size);
entry = &(carr_table->entries[bucket]);

if (safe)
Expand Down Expand Up @@ -1389,7 +1389,7 @@ static mi_response_t * mi_delete_carrier_rate(const mi_params_t *params,struct m

LM_INFO("XXX - deleteCarrierRate %.*s\n",carrier.len,carrier.s);

bucket = core_hash(&carrier,0,carr_table->size);
bucket = core_hash(&carrier, NULL, carr_table->size);
entry = &(carr_table->entries[bucket]);

lock_bucket_write( entry->lock );
Expand Down Expand Up @@ -1435,7 +1435,7 @@ static mi_response_t * mi_delete_carrier(const mi_params_t *params,struct mi_han

LM_INFO("XXX - deleteCarrier %.*s\n",carrier.len,carrier.s);

bucket = core_hash(&carrier,0,carr_table->size);
bucket = core_hash(&carrier, NULL, carr_table->size);
entry = &(carr_table->entries[bucket]);

lock_bucket_write( entry->lock );
Expand Down Expand Up @@ -1489,7 +1489,7 @@ static mi_response_t * mi_get_client_price(const mi_params_t *params,struct mi_h
&prefix.s, &prefix.len) < 0)
return init_mi_param_error();

bucket = core_hash(&accountid,0,acc_table->size);
bucket = core_hash(&accountid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

lock_bucket_read( entry->lock );
Expand Down Expand Up @@ -1620,7 +1620,7 @@ static mi_response_t * mi_delete_client(const mi_params_t *params,struct mi_hand

LM_INFO("XXX - deleteClient %.*s\n",accountid.len,accountid.s);

bucket = core_hash(&accountid,0,acc_table->size);
bucket = core_hash(&accountid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

lock_bucket_write( entry->lock );
Expand Down Expand Up @@ -1683,7 +1683,7 @@ static mi_response_t * mi_delete_client_rate(const mi_params_t *params,struct mi

LM_INFO("XXX - deleteClientRate %.*s %d\n",accountid.len,accountid.s,wholesale);

bucket = core_hash(&accountid,0,acc_table->size);
bucket = core_hash(&accountid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

lock_bucket_write( entry->lock );
Expand Down Expand Up @@ -1761,7 +1761,7 @@ static int script_get_client_price(struct sip_msg *msg, str *clientid, int *isws
unsigned int matched_len;
pv_value_t pv_val;

bucket = core_hash(clientid,0,acc_table->size);
bucket = core_hash(clientid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

lock_bucket_read( entry->lock );
Expand Down Expand Up @@ -1847,7 +1847,7 @@ static int script_get_vendor_price(struct sip_msg *msg, str *vendorid,
struct ratesheet_cell_entry *ret;
pv_value_t pv_val;

bucket = core_hash(vendorid,0,carr_table->size);
bucket = core_hash(vendorid, NULL, carr_table->size);
entry = &(carr_table->entries[bucket]);

lock_bucket_read( entry->lock );
Expand Down Expand Up @@ -1932,7 +1932,7 @@ static double* bulk_cost_based_fetching(str *clientid,int isws, str *carrierlist
if (client_price == NULL)
return NULL;

bucket = core_hash(clientid,0,acc_table->size);
bucket = core_hash(clientid, NULL, acc_table->size);
entry = &(acc_table->entries[bucket]);

lock_bucket_read( entry->lock );
Expand Down Expand Up @@ -1975,7 +1975,7 @@ static double* bulk_cost_based_fetching(str *clientid,int isws, str *carrierlist
for (i=0;i<carr_no;i++) {
carrier = carrierlist[i];

bucket = core_hash(&carrier,0,carr_table->size);
bucket = core_hash(&carrier, NULL, carr_table->size);
carr_entry = &(carr_table->entries[bucket]);

lock_bucket_read( carr_entry->lock );
Expand Down
2 changes: 1 addition & 1 deletion modules/uac_auth/auth.c
Expand Up @@ -402,7 +402,7 @@ void do_uac_auth(str *msg_body, str *method, str *uri, struct uac_credential *cr
if((auth->flags&QOP_AUTH) || (auth->flags&QOP_AUTH_INT))
{
/* if qop generate nonce-count and cnonce */
cnonce.s = int2str(core_hash(&auth->nonce, 0, 0),&cnonce.len);
cnonce.s = int2str(core_hash(&auth->nonce, NULL, 0),&cnonce.len);

/* do authentication */
if (!has_ha1)
Expand Down
8 changes: 4 additions & 4 deletions modules/usrloc/udomain.c
Expand Up @@ -150,7 +150,7 @@ get_static_urecord(const udomain_t* _d, const str* _aor, struct urecord** _r)

r.aor = *_aor;
r.domain = _d->name;
r.aorhash = core_hash(_aor, 0, DB_AOR_HASH_MASK);
r.aorhash = core_hash(_aor, NULL, DB_AOR_HASH_MASK);
r.is_static = 1;

*_r = &r;
Expand Down Expand Up @@ -1221,7 +1221,7 @@ void lock_udomain(udomain_t* _d, str* _aor)
unsigned int sl;
if (have_mem_storage())
{
sl = core_hash(_aor, 0, _d->size);
sl = core_hash(_aor, NULL, _d->size);

#ifdef GEN_LOCK_T_PREFERED
lock_get(_d->table[sl].lock);
Expand All @@ -1240,7 +1240,7 @@ void unlock_udomain(udomain_t* _d, str* _aor)
unsigned int sl;
if (have_mem_storage())
{
sl = core_hash(_aor, 0, _d->size);
sl = core_hash(_aor, NULL, _d->size);
#ifdef GEN_LOCK_T_PREFERED
lock_release(_d->table[sl].lock);
#else
Expand Down Expand Up @@ -1389,7 +1389,7 @@ static inline urecord_t *find_mem_urecord(udomain_t *_d, const str *_aor)
unsigned int sl, aorhash;
urecord_t **r;

aorhash = core_hash(_aor, 0, 0);
aorhash = core_hash(_aor, NULL, 0);
sl = aorhash & (_d->size - 1);

r = (urecord_t **)map_find(_d->table[sl].records, *_aor);
Expand Down
2 changes: 1 addition & 1 deletion modules/usrloc/urecord.c
Expand Up @@ -93,7 +93,7 @@ int new_urecord(str* _dom, str* _aor, urecord_t** _r)
memcpy((*_r)->aor.s, _aor->s, _aor->len);
(*_r)->aor.len = _aor->len;
(*_r)->domain = _dom;
(*_r)->aorhash = core_hash(_aor, 0, 0);
(*_r)->aorhash = core_hash(_aor, NULL, 0);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion statistics.c
Expand Up @@ -96,7 +96,7 @@ static mi_export_t mi_stat_cmds[] = {
gen_lock_t *stat_lock = 0;
#endif

#define stat_hash(_s) core_hash( _s, 0, STATS_HASH_SIZE)
#define stat_hash(_s) core_hash( _s, NULL, STATS_HASH_SIZE)

#define stat_is_hidden(_s) ((_s)->flags&STAT_HIDDEN)

Expand Down

0 comments on commit 87b9286

Please sign in to comment.