Module: kamailio Branch: master Commit: aad751ab54f37f3482641488929133296974025e URL: https://github.com/kamailio/kamailio/commit/aad751ab54f37f348264148892913329...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: 2018-01-04T09:39:31+01:00
presence: pass dbf structure by pointer instead of value to function param
- passing large values is not optimal
---
Modified: src/modules/presence/subscribe.c Modified: src/modules/presence/subscribe.h
---
Diff: https://github.com/kamailio/kamailio/commit/aad751ab54f37f348264148892913329... Patch: https://github.com/kamailio/kamailio/commit/aad751ab54f37f348264148892913329...
---
diff --git a/src/modules/presence/subscribe.c b/src/modules/presence/subscribe.c index 36329ab198..3c6e4458d4 100644 --- a/src/modules/presence/subscribe.c +++ b/src/modules/presence/subscribe.c @@ -2222,7 +2222,7 @@ void update_db_subs_timer_dbnone(int no_lock)
-void update_db_subs_timer(db1_con_t *db,db_func_t dbf, shtable_t hash_table, +void update_db_subs_timer(db1_con_t *db,db_func_t *dbf, shtable_t hash_table, int htable_size, int no_lock, handle_expired_func_t handle_expired_func) { db_key_t query_cols[25], update_cols[8]; @@ -2468,7 +2468,7 @@ void update_db_subs_timer(db1_con_t *db,db_func_t dbf, shtable_t hash_table, update_vals[u_contact_col].val.str_val = s->contact; update_vals[u_record_route_col].val.str_val = s->record_route;
- if(dbf.update(db, query_cols, 0, query_vals, update_cols, + if(dbf->update(db, query_cols, 0, query_vals, update_cols, update_vals, n_query_update, n_update_cols)< 0) { LM_ERR("updating in database\n"); @@ -2507,7 +2507,7 @@ void update_db_subs_timer(db1_con_t *db,db_func_t dbf, shtable_t hash_table, query_vals[user_agent_col].val.str_val = s->user_agent;
- if(dbf.insert(db,query_cols,query_vals,n_query_cols )<0) + if(dbf->insert(db,query_cols,query_vals,n_query_cols )<0) { LM_ERR("unsuccessful sql insert\n"); } else { @@ -2524,7 +2524,7 @@ void update_db_subs_timer(db1_con_t *db,db_func_t dbf, shtable_t hash_table,
update_vals[0].val.int_val= (int)time(NULL) - expires_offset; update_ops[0]= OP_LT; - if(dbf.delete(db, update_cols, update_ops, update_vals, 1) < 0) + if(dbf->delete(db, update_cols, update_ops, update_vals, 1) < 0) { LM_ERR("deleting expired information from database\n"); } @@ -2561,7 +2561,7 @@ void timer_db_update(unsigned int ticks,void *param) LM_ERR("sql use table failed\n"); return; } - update_db_subs_timer(pa_db, pa_dbf, subs_htable, shtable_size, + update_db_subs_timer(pa_db, &pa_dbf, subs_htable, shtable_size, no_lock, handle_expired_subs); } } diff --git a/src/modules/presence/subscribe.h b/src/modules/presence/subscribe.h index e71b062367..6f3cd637d8 100644 --- a/src/modules/presence/subscribe.h +++ b/src/modules/presence/subscribe.h @@ -109,10 +109,10 @@ int restore_db_subs(void);
typedef int (*handle_expired_func_t)(subs_t* );
-void update_db_subs_timer(db1_con_t *db,db_func_t dbf, shtable_t hash_table, +void update_db_subs_timer(db1_con_t *db,db_func_t *dbf, shtable_t hash_table, int htable_size, int no_lock, handle_expired_func_t handle_expired_func);
-typedef void (*update_db_subs_t)(db1_con_t * ,db_func_t ,shtable_t ,int ,int , +typedef void (*update_db_subs_t)(db1_con_t* ,db_func_t* ,shtable_t ,int ,int , handle_expired_func_t);
int extract_sdialog_info_ex(subs_t* subs,struct sip_msg* msg, uint32_t min_expire,