Change in osmo-msc[master]: use vty->type instead of local variable

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Stefan Sperling gerrit-no-reply at lists.osmocom.org
Tue Dec 18 18:00:07 UTC 2018


Stefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/12353


Change subject: use vty->type instead of local variable
......................................................................

use vty->type instead of local variable

We can check if we're parsing the config file by checking
whether vty->type equals VTY_FILE. This avoids the use of
an extra local variable to track the parsing state.

Change-Id: I85161575e025f7c389832427a434bd8e2d6ecc75
Fixes: 1051c4208834c22d344dd92d25addfd8e5d95993
Related: OS#3355
---
M include/osmocom/msc/vty.h
M src/libmsc/msc_vty.c
M src/osmo-msc/msc_main.c
3 files changed, 1 insertion(+), 7 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/53/12353/1

diff --git a/include/osmocom/msc/vty.h b/include/osmocom/msc/vty.h
index 60a36d7..6a55df7 100644
--- a/include/osmocom/msc/vty.h
+++ b/include/osmocom/msc/vty.h
@@ -31,6 +31,4 @@
 
 struct gsm_network *gsmnet_from_vty(struct vty *vty);
 
-extern bool msc_parsing_config_file;
-
 #endif
diff --git a/src/libmsc/msc_vty.c b/src/libmsc/msc_vty.c
index 87adc82..13790bb 100644
--- a/src/libmsc/msc_vty.c
+++ b/src/libmsc/msc_vty.c
@@ -466,7 +466,7 @@
       "This name is used for GSUP routing and must be set if more than one MSC is connected to the HLR. "
       "The default is 'MSC-00-00-00-00-00-00'.\n")
 {
-	if (!msc_parsing_config_file) {
+	if (vty->type != VTY_FILE) {
 		vty_out(vty, "The IPA name cannot be changed at run-time; "
 			"It can only be set in the configuraton file.%s", VTY_NEWLINE);
 		return CMD_WARNING;
diff --git a/src/osmo-msc/msc_main.c b/src/osmo-msc/msc_main.c
index 4dce2b8..6eecf46 100644
--- a/src/osmo-msc/msc_main.c
+++ b/src/osmo-msc/msc_main.c
@@ -515,8 +515,6 @@
 extern void *tall_call_ctx;
 extern void *tall_trans_ctx;
 
-bool msc_parsing_config_file = false;
-
 int main(int argc, char **argv)
 {
 	int rc;
@@ -569,9 +567,7 @@
 		return -1;
 #endif
 
-	msc_parsing_config_file = true;
 	rc = vty_read_config_file(msc_cmdline_config.config_file, NULL);
-	msc_parsing_config_file = false;
 	if (rc < 0) {
 		LOGP(DMSC, LOGL_FATAL, "Failed to parse the config file: '%s'\n",
 		     msc_cmdline_config.config_file);

-- 
To view, visit https://gerrit.osmocom.org/12353
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I85161575e025f7c389832427a434bd8e2d6ecc75
Gerrit-Change-Number: 12353
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <stsp at stsp.name>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181218/a6066286/attachment.htm>


More information about the gerrit-log mailing list