[sr-dev] git:master:e9acce2d: pua_usrloc: removed local variables aliasing functions from pua api

Daniel-Constantin Mierla miconda at gmail.com
Tue Nov 3 23:07:17 CET 2015


Module: kamailio
Branch: master
Commit: e9acce2d1bf295e1b6707fc1c16f53fc160978cb
URL: https://github.com/kamailio/kamailio/commit/e9acce2d1bf295e1b6707fc1c16f53fc160978cb

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-11-03T23:06:14+01:00

pua_usrloc: removed local variables aliasing functions from pua api

- use directly the pua bind structure, which was global already

---

Modified: modules/pua_usrloc/pua_usrloc.c
Modified: modules/pua_usrloc/pua_usrloc.h
Modified: modules/pua_usrloc/ul_publish.c

---

Diff:  https://github.com/kamailio/kamailio/commit/e9acce2d1bf295e1b6707fc1c16f53fc160978cb.diff
Patch: https://github.com/kamailio/kamailio/commit/e9acce2d1bf295e1b6707fc1c16f53fc160978cb.patch

---

diff --git a/modules/pua_usrloc/pua_usrloc.c b/modules/pua_usrloc/pua_usrloc.c
index f81a77b..e8044fe 100644
--- a/modules/pua_usrloc/pua_usrloc.c
+++ b/modules/pua_usrloc/pua_usrloc.c
@@ -64,7 +64,7 @@ int pua_ul_publish = 0;
 int pua_ul_bflag = -1;
 int pua_ul_bmask = 0;
 
-pua_api_t pua;
+pua_api_t _pu_pua;
 str pres_prefix= STR_NULL;
 
 /*! \brief Structure containing pointers to usrloc functions */
@@ -76,9 +76,6 @@ static int mod_init(void);
 
 int pua_set_publish(struct sip_msg* , char*, char*);
 
-send_publish_t pua_send_publish;
-send_subscribe_t pua_send_subscribe;
-
 static cmd_export_t cmds[]=
 {
 	{"pua_set_publish", (cmd_function)pua_set_publish, 0, 0, 0, REQUEST_ROUTE},
@@ -174,24 +171,22 @@ static int mod_init(void)
 		return -1;
 	}
 	
-	if (bind_pua(&pua) < 0)
+	if (bind_pua(&_pu_pua) < 0)
 	{
 		LM_ERR("Can't bind pua\n");
 		return -1;
 	}
-	if(pua.send_publish == NULL)
+	if(_pu_pua.send_publish == NULL)
 	{
 		LM_ERR("Could not import send_publish\n");
 		return -1;
 	}
-	pua_send_publish= pua.send_publish;
 
-	if(pua.send_subscribe == NULL)
+	if(_pu_pua.send_subscribe == NULL)
 	{
 		LM_ERR("Could not import send_subscribe\n");
 		return -1;
 	}
-	pua_send_subscribe= pua.send_subscribe;
 	
 	/* register post-script pua_unset_publish unset function */
 	if(register_script_cb(pua_unset_publish, POST_SCRIPT_CB|REQUEST_CB, 0)<0)
diff --git a/modules/pua_usrloc/pua_usrloc.h b/modules/pua_usrloc/pua_usrloc.h
index 452d8d6..66371e9 100644
--- a/modules/pua_usrloc/pua_usrloc.h
+++ b/modules/pua_usrloc/pua_usrloc.h
@@ -34,8 +34,6 @@
 #define _PUA_UL_
 #include "../pua/pua_bind.h"
 
-extern send_publish_t pua_send_publish;
-extern send_subscribe_t pua_send_subscribe;
 void ul_publish(ucontact_t* c, int type, void* param);
 int pua_unset_publish(struct sip_msg* msg, unsigned int flags, void* param);
 
@@ -43,4 +41,5 @@ extern str pres_prefix;
 extern int pua_ul_bflag;
 extern int pua_ul_bmask;
 
+extern pua_api_t _pu_pua;
 #endif
diff --git a/modules/pua_usrloc/ul_publish.c b/modules/pua_usrloc/ul_publish.c
index 566a9eb..beb5aa6 100644
--- a/modules/pua_usrloc/ul_publish.c
+++ b/modules/pua_usrloc/ul_publish.c
@@ -321,7 +321,7 @@ void ul_publish(ucontact_t* c, int type, void* param)
 	publ->event|= PRESENCE_EVENT;
 	publ->extra_headers= NULL;
 	print_publ(publ);
-	if((error=pua_send_publish(publ))< 0)
+	if((error=_pu_pua.send_publish(publ))< 0)
 	{
 		LM_ERR("while sending publish for ul event %d\n", type);
 		if((type & UL_CONTACT_UPDATE) && error == ERR_PUBLISH_NO_BODY) {




More information about the sr-dev mailing list