Ver Fonte

dmq: rename global variables with short name

- safety for symbols overlapping
Daniel-Constantin Mierla há 1 ano atrás
pai
commit
f0fbf4d74b

+ 4 - 4
src/modules/dmq/dmq.c

@@ -68,9 +68,9 @@ static sip_uri_t dmq_notification_uri = {0};
 int dmq_ping_interval = 60;
 
 /* TM bind */
-struct tm_binds tmb = {0};
+struct tm_binds _dmq_tmb = {0};
 /* SL API structure */
-sl_api_t slb = {0};
+sl_api_t _dmq_slb = {0};
 
 /** module variables */
 str dmq_request_method = str_init("KDMQ");
@@ -190,13 +190,13 @@ static int make_socket_str_from_uri(struct sip_uri *uri, str *socket)
 static int mod_init(void)
 {
 	/* bind the SL API */
-	if(sl_load_api(&slb) != 0) {
+	if(sl_load_api(&_dmq_slb) != 0) {
 		LM_ERR("cannot bind to SL API\n");
 		return -1;
 	}
 
 	/* load all TM stuff */
-	if(load_tm_api(&tmb) == -1) {
+	if(load_tm_api(&_dmq_tmb) == -1) {
 		LM_ERR("can't load tm functions. TM module probably not loaded\n");
 		return -1;
 	}

+ 2 - 2
src/modules/dmq/dmq.h

@@ -49,8 +49,8 @@ extern sip_uri_t dmq_server_uri;
 extern str_list_t *dmq_notification_address_list;
 extern int dmq_multi_notify;
 /* sl and tm */
-extern struct tm_binds tmb;
-extern sl_api_t slb;
+extern struct tm_binds _dmq_tmb;
+extern sl_api_t _dmq_slb;
 
 extern str dmq_200_rpl;
 extern str dmq_400_rpl;

+ 3 - 3
src/modules/dmq/dmq_funcs.c

@@ -266,9 +266,9 @@ int dmq_send_message(dmq_peer_t *peer, str *body, dmq_node_t *node,
 			TMCB_LOCAL_COMPLETED, dmq_tm_callback, (void *)cb_param);
 	uac_r.ssock = &dmq_server_socket;
 
-	result = tmb.t_request(&uac_r, &to, &to, &from, NULL);
+	result = _dmq_tmb.t_request(&uac_r, &to, &to, &from, NULL);
 	if(result < 0) {
-		LM_ERR("error in tmb.t_request_within\n");
+		LM_ERR("error in tm t_request_within()\n");
 		goto error;
 	}
 	pkg_free(str_hdr.s);
@@ -468,7 +468,7 @@ int ki_dmq_t_replicate_mode(struct sip_msg *msg, int mode)
 			first = 0;
 		}
 
-		if(tmb.t_replicate(msg, &node->orig_uri) < 0) {
+		if(_dmq_tmb.t_replicate(msg, &node->orig_uri) < 0) {
 			LM_ERR("error calling t_replicate\n");
 			goto error;
 		}

+ 3 - 3
src/modules/dmq/message.c

@@ -94,7 +94,7 @@ int ki_dmq_handle_message_rc(sip_msg_t *msg, int returnval)
 	if(!peer) {
 		LM_DBG("no peer found for %.*s\n", msg->parsed_uri.user.len,
 				msg->parsed_uri.user.s);
-		if(slb.freply(msg, 404, &dmq_404_rpl) < 0) {
+		if(_dmq_slb.freply(msg, 404, &dmq_404_rpl) < 0) {
 			LM_ERR("sending reply\n");
 			goto error;
 		}
@@ -158,7 +158,7 @@ int ki_dmq_process_message_rc(sip_msg_t *msg, int returnval)
 	if(!peer) {
 		LM_DBG("no peer found for %.*s\n", msg->parsed_uri.user.len,
 				msg->parsed_uri.user.s);
-		if(slb.freply(msg, 404, &dmq_404_rpl) < 0) {
+		if(_dmq_slb.freply(msg, 404, &dmq_404_rpl) < 0) {
 			LM_ERR("sending reply\n");
 			goto error;
 		}
@@ -190,7 +190,7 @@ int ki_dmq_process_message_rc(sip_msg_t *msg, int returnval)
 	/* send the reply */
 	if(peer_response.resp_code > 0 && peer_response.reason.s != NULL
 			&& peer_response.reason.len > 0) {
-		if(slb.freply(msg, peer_response.resp_code, &peer_response.reason)
+		if(_dmq_slb.freply(msg, peer_response.resp_code, &peer_response.reason)
 				< 0) {
 			LM_ERR("error sending reply\n");
 		} else {

+ 2 - 2
src/modules/dmq/worker.c

@@ -95,8 +95,8 @@ void worker_loop(int id)
 				/* send the reply */
 				if(peer_response.resp_code > 0 && peer_response.reason.s != NULL
 						&& peer_response.reason.len > 0) {
-					if(slb.freply(current_job->msg, peer_response.resp_code,
-							   &peer_response.reason)
+					if(_dmq_slb.freply(current_job->msg,
+							   peer_response.resp_code, &peer_response.reason)
 							< 0) {
 						LM_ERR("error sending reply\n");
 					} else {