[sr-dev] git:master: modules: fixed several compile warnings

Daniel-Constantin Mierla miconda at gmail.com
Tue Dec 27 11:48:21 CET 2011


Module: sip-router
Branch: master
Commit: 7400516f1e301226136604c520291924a83dec8b
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=7400516f1e301226136604c520291924a83dec8b

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Tue Dec 27 11:46:37 2011 +0100

modules: fixed several compile warnings

- removed unused variables, initialized some

---

 modules/avpops/avpops.c                       |    2 --
 modules/avpops/avpops_impl.c                  |    2 --
 modules/mi_rpc/mi_rpc_mod.c                   |    2 --
 modules/mtree/mtree.c                         |    3 ---
 modules/sdpops/sdpops_mod.c                   |    3 ---
 modules/sms/sms_funcs.c                       |    3 ---
 modules_k/dispatcher/dispatch.c               |    2 --
 modules_k/imc/imc_mng.c                       |    4 ++--
 modules_k/kex/core_stats.c                    |    8 +++-----
 modules_k/mi_datagram/datagram_fnc.c          |    3 +--
 modules_k/presence_profile/presence_profile.c |    2 +-
 modules_k/siptrace/siptrace.c                 |    2 --
 modules_k/tmx/t_mi.c                          |    2 ++
 13 files changed, 9 insertions(+), 29 deletions(-)

diff --git a/modules/avpops/avpops.c b/modules/avpops/avpops.c
index 440c8f6..4de02a1 100644
--- a/modules/avpops/avpops.c
+++ b/modules/avpops/avpops.c
@@ -213,12 +213,10 @@ static int fixup_db_avp(void** param, int param_no, int allow_scheme)
 	struct fis_param *sp;
 	struct db_param  *dbp;
 	int flags;
-	int flags0;
 	str s;
 	char *p;
 
 	flags=0;
-	flags0=0;
 	if (db_url.s==0)
 	{
 		LM_ERR("you have to configure a db_url for using avp_db_xxx functions\n");
diff --git a/modules/avpops/avpops_impl.c b/modules/avpops/avpops_impl.c
index bf1e822..09d6769 100644
--- a/modules/avpops/avpops_impl.c
+++ b/modules/avpops/avpops_impl.c
@@ -1469,7 +1469,6 @@ int ops_op_avp( struct sip_msg* msg, struct fis_param** av,
 	int_str           avp_name3;
 	int_str           avp_val;
 	int_str           op_val;
-	int               op_flags;
 	int               result;
 	pv_value_t        xvalue;
 
@@ -1526,7 +1525,6 @@ cycle1:
 	if (val->opd&AVPOPS_VAL_PVAR)
 	{
 		/* the 2nd operator is variable -> get value */
-		op_flags = 0;
 		if(val->u.sval.type==PVT_AVP)
 		{
 			/* search for the avp */
diff --git a/modules/mi_rpc/mi_rpc_mod.c b/modules/mi_rpc/mi_rpc_mod.c
index aeabddd..4bcd7c6 100644
--- a/modules/mi_rpc/mi_rpc_mod.c
+++ b/modules/mi_rpc/mi_rpc_mod.c
@@ -501,7 +501,6 @@ static struct mi_root* mi_run_rpc(struct mi_root* cmd_tree, void* param)
 	
 	str *fn;
 	struct mi_node *node;
-	int len;
 	char *command = NULL;
 	int param_count = 0;
 	char **parameters = NULL;
@@ -530,7 +529,6 @@ static struct mi_root* mi_run_rpc(struct mi_root* cmd_tree, void* param)
 		return( init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN ));
 
 	fn = &node->value;
-	len = fn->len +1;
 	
 	/* find_rpc_exports needs 0 terminated strings */
 	command = pkg_malloc(fn->len+1);
diff --git a/modules/mtree/mtree.c b/modules/mtree/mtree.c
index 351dfae..8b83cd9 100644
--- a/modules/mtree/mtree.c
+++ b/modules/mtree/mtree.c
@@ -385,7 +385,6 @@ int mt_match_prefix(struct sip_msg *msg, m_tree_t *it,
 	int l, len, n;
 	int i, j;
 	mt_node_t *itn;
-	int ret;
 	is_t *tvalue;
 	int_str dstid_avp_name;
 	unsigned short dstid_name_type;
@@ -405,8 +404,6 @@ int mt_match_prefix(struct sip_msg *msg, m_tree_t *it,
 		return -1;
 	}
 
-	ret = 0;
-
 	l = len = 0;
 	n = 0;
 	if ((it->type==MT_TREE_SVAL) || (it->type==MT_TREE_IVAL)) {
diff --git a/modules/sdpops/sdpops_mod.c b/modules/sdpops/sdpops_mod.c
index be2e840..c2d9e9f 100644
--- a/modules/sdpops/sdpops_mod.c
+++ b/modules/sdpops/sdpops_mod.c
@@ -595,7 +595,6 @@ static int w_sdp_keep_codecs_by_name(sip_msg_t* msg, char* codecs, char* media)
  */
 static int sdp_with_media(sip_msg_t *msg, str *media)
 {
-	sdp_info_t *sdp = NULL;
 	int sdp_session_num;
 	int sdp_stream_num;
 	sdp_session_cell_t* sdp_session;
@@ -609,8 +608,6 @@ static int sdp_with_media(sip_msg_t *msg, str *media)
 	LM_DBG("attempting to search for media type: [%.*s]\n",
 			media->len, media->s);
 
-	sdp = (sdp_info_t*)msg->body;
-
 	sdp_session_num = 0;
 	for(;;)
 	{
diff --git a/modules/sms/sms_funcs.c b/modules/sms/sms_funcs.c
index 9a4afa6..5561301 100644
--- a/modules/sms/sms_funcs.c
+++ b/modules/sms/sms_funcs.c
@@ -65,7 +65,6 @@ struct network networks[MAX_NETWORKS];
 int net_pipes_in[MAX_NETWORKS];
 int nr_of_networks;
 int nr_of_modems;
-int max_sms_parts;
 int *queued_msgs;
 int use_contact;
 struct tm_binds tmb;
@@ -545,7 +544,6 @@ int send_sms_as_sip( struct incame_sms *sms )
 	str  sip_body;
 	str  sip_from;
 	int  is_pattern;
-	int  in_address;
 	int  k;
 	char *p;
 
@@ -559,7 +557,6 @@ int send_sms_as_sip( struct incame_sms *sms )
 	      sip address inside; everything before it is ignored, only the
 	      part following the address being send as sip
 	*/
-	in_address = 0;
 	sip_addr.len = 0;
 	sip_body.len = 0;
 	p = sms->ascii;
diff --git a/modules_k/dispatcher/dispatch.c b/modules_k/dispatcher/dispatch.c
index 4cd57a2..7547897 100644
--- a/modules_k/dispatcher/dispatch.c
+++ b/modules_k/dispatcher/dispatch.c
@@ -1511,7 +1511,6 @@ static inline int ds_update_dst(struct sip_msg *msg, str *uri, int mode)
 {
 	struct action act;
 	struct run_act_ctx ra_ctx;
-	str *duri = NULL;
 	switch(mode)
 	{
 		case 1:
@@ -1530,7 +1529,6 @@ static inline int ds_update_dst(struct sip_msg *msg, str *uri, int mode)
 			}
 			break;
 		default:
-			duri = uri;
 			if (set_dst_uri(msg, uri) < 0) {
 				LM_ERR("error while setting dst uri\n");
 				return -1;
diff --git a/modules_k/imc/imc_mng.c b/modules_k/imc/imc_mng.c
index 1c739e6..e82b267 100644
--- a/modules_k/imc/imc_mng.c
+++ b/modules_k/imc/imc_mng.c
@@ -88,7 +88,7 @@ error:
  */
 int imc_htable_destroy(void)
 {
-	int i,room_deleted;
+	int i;
 	imc_room_p irp = NULL, irp_temp=NULL;
 	if(_imc_htable==NULL)
 		return -1;
@@ -101,7 +101,7 @@ int imc_htable_destroy(void)
 			irp = _imc_htable[i].rooms;
 			while(irp){
 				irp_temp = irp->next;
-				room_deleted = imc_del_room(&irp->name, &irp->domain);
+				imc_del_room(&irp->name, &irp->domain);
 				irp = irp_temp;
 			}
 	}
diff --git a/modules_k/kex/core_stats.c b/modules_k/kex/core_stats.c
index 009a906..6b77ae1 100644
--- a/modules_k/kex/core_stats.c
+++ b/modules_k/kex/core_stats.c
@@ -221,10 +221,9 @@ inline static int mi_add_stat(struct mi_node *rpl, stat_var *stat)
 static void mi_add_grp_vars_cbk(void* r, str* g, str* n, counter_handle_t h)
 {
 	struct mi_node *rpl;
-	struct mi_node *node;
 	
 	rpl = r;
-	node = addf_mi_node_child(rpl, 0, 0, 0, "%.*s:%.*s = %lu",
+	addf_mi_node_child(rpl, 0, 0, 0, "%.*s:%.*s = %lu",
 							g->len, g->s, n->len, n->s, counter_get_val(h));
 }
 
@@ -365,7 +364,6 @@ inline static int mi_reset_and_add_stat(struct mi_node *rpl, stat_var *stat)
 static void mi_add_grp_vars_cbk2(void* r, str* g, str* n, counter_handle_t h)
 {
 	struct mi_node *rpl;
-	struct mi_node *node;
 	counter_val_t old_val, new_val;
 
 	rpl = r;
@@ -375,10 +373,10 @@ static void mi_add_grp_vars_cbk2(void* r, str* g, str* n, counter_handle_t h)
 
 	if (old_val==new_val)
 	{
-		node = addf_mi_node_child(rpl, 0, 0, 0, "%.*s:%.*s = %lu",
+		addf_mi_node_child(rpl, 0, 0, 0, "%.*s:%.*s = %lu",
 					g->len, g->s, n->len, n->s, new_val);
 	} else {
-		node = addf_mi_node_child(rpl, 0, 0, 0, "%.*s:%.*s = %lu (%lu)",
+		addf_mi_node_child(rpl, 0, 0, 0, "%.*s:%.*s = %lu (%lu)",
 					g->len, g->s, n->len, n->s, new_val, old_val);
 	}
 }
diff --git a/modules_k/mi_datagram/datagram_fnc.c b/modules_k/mi_datagram/datagram_fnc.c
index e93949a..9ca206c 100644
--- a/modules_k/mi_datagram/datagram_fnc.c
+++ b/modules_k/mi_datagram/datagram_fnc.c
@@ -263,11 +263,10 @@ static int mi_send_dgram(int fd, char* buf, unsigned int len,
  * line is correct and exists*/
 static int identify_command(datagram_stream * dtgram, struct mi_cmd * *f)
 {
-	char *command,*p, *start;
+	char *command,*p;
 
 	/* default offset for the command: 0 */
 	p= dtgram->start;
-	start = p;
 	if (!p){
 		LM_ERR("null pointer  \n");
 		return -1;
diff --git a/modules_k/presence_profile/presence_profile.c b/modules_k/presence_profile/presence_profile.c
index 686dbd5..55f8902 100644
--- a/modules_k/presence_profile/presence_profile.c
+++ b/modules_k/presence_profile/presence_profile.c
@@ -105,7 +105,7 @@ static int mod_init(void)
     }
 
     pres_add_event = pres.add_event;
-    if (add_event == NULL) {
+    if (pres_add_event == NULL) {
 	LM_ERR("could not import add_event\n");
 	return -1;
     }
diff --git a/modules_k/siptrace/siptrace.c b/modules_k/siptrace/siptrace.c
index a912fb4..d845ae8 100644
--- a/modules_k/siptrace/siptrace.c
+++ b/modules_k/siptrace/siptrace.c
@@ -1279,7 +1279,6 @@ static void trace_sl_onreply_out(sl_cbp_t *slcbp)
 {
 	sip_msg_t *req;
 	struct _siptrace_data sto;
-	int faked = 0;
 	struct sip_msg* msg;
 	struct ip_addr to_ip;
 	int len;
@@ -1303,7 +1302,6 @@ static void trace_sl_onreply_out(sl_cbp_t *slcbp)
 	}
 
 	msg = req;
-	faked = 1;
 
 	if(sip_trace_prepare(msg)<0)
 		return;
diff --git a/modules_k/tmx/t_mi.c b/modules_k/tmx/t_mi.c
index 4e31220..dd20fcc 100644
--- a/modules_k/tmx/t_mi.c
+++ b/modules_k/tmx/t_mi.c
@@ -477,6 +477,8 @@ struct mi_root*  mi_tm_uac_dlg(struct mi_root* cmd_tree, void* param)
 	if ( !(n==5 || n==6) || node!=0)
 		return init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);
 
+	cseq = -1;
+
 	/* method name (param 1) */
 	node = cmd_tree->node.kids;
 	method = &node->value;




More information about the sr-dev mailing list