[sr-dev] git:master:cbc0c720: dialog: set dlg var table as static and rename to avoid name conflicts

Daniel-Constantin Mierla miconda at gmail.com
Tue Aug 25 13:37:57 CEST 2015


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

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date: 2015-08-25T13:35:30+02:00

dialog: set dlg var table as static and rename to avoid name conflicts

---

Modified: modules/dialog/dlg_var.c

---

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

---

diff --git a/modules/dialog/dlg_var.c b/modules/dialog/dlg_var.c
index b4f821e..a3c7b8e 100644
--- a/modules/dialog/dlg_var.c
+++ b/modules/dialog/dlg_var.c
@@ -40,7 +40,7 @@ dlg_ctx_t _dlg_ctx;
 extern int spiral_detected;
 
 /*! global variable table, in case the dialog does not exist yet */
-struct dlg_var * var_table = 0;
+static struct dlg_var *_dlg_var_table = 0;
 /*! ID of the current message */
 int msg_id;
 
@@ -127,13 +127,14 @@ static inline struct dlg_var *new_dlg_var(str *key, str *val)
 /*! Delete the current var-list */
 void free_local_varlist() {
 	struct dlg_var *var;
-	while (var_table) {
-		var = var_table;
-		var_table = var_table->next;
+	while (_dlg_var_table) {
+		var = _dlg_var_table;
+		_dlg_var_table = _dlg_var_table->next;
 		shm_free(var->key.s);
 		shm_free(var->value.s);
 		shm_free(var);
 	}
+	_dlg_var_table = NULL;
 }
 
 /*! Retrieve the local var-list pointer */
@@ -144,9 +145,9 @@ struct dlg_var * get_local_varlist_pointer(struct sip_msg *msg, int clear_pointe
 		free_local_varlist();
 		msg_id = msg->id;
 	}
-	var = var_table;
+	var = _dlg_var_table;
 	if (clear_pointer)
-		var_table = NULL;
+		_dlg_var_table = NULL;
 	return var;
 }
 
@@ -161,7 +162,7 @@ int set_dlg_variable_unsafe(struct dlg_cell *dlg, str *key, str *val)
 	if (dlg) 
 		var_list = &dlg->vars;
 	else 
-		var_list = &var_table;
+		var_list = &_dlg_var_table;
 
 	if ( val && (var=new_dlg_var(key, val))==NULL) {
 		LM_ERR("failed to create new dialog variable\n");
@@ -216,7 +217,7 @@ str * get_dlg_variable_unsafe(struct dlg_cell *dlg, str *key)
 	if (dlg) 
 		var_list = dlg->vars;
 	else
-		var_list = var_table;
+		var_list = _dlg_var_table;
 
 	/* iterate the list */
 	for(var=var_list ; var ; var=var->next) {
@@ -244,7 +245,7 @@ int pv_parse_dialog_var_name(pv_spec_p sp, str *in)
 /*! Internal debugging function: Prints the list of dialogs */
 void print_lists(struct dlg_cell *dlg) {
 	struct dlg_var *varlist;
-	varlist = var_table;
+	varlist = _dlg_var_table;
 	LM_DBG("Internal var-list (%p):\n", varlist);
 	while (varlist) {
 		LM_DBG("%.*s=%.*s (flags %i)\n",




More information about the sr-dev mailing list