Change in osmo-mgw[master]: mgcp_client_vty: remove unnecessary checks

laforge gerrit-no-reply at lists.osmocom.org
Tue Aug 17 12:12:26 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-mgw/+/25029 )

Change subject: mgcp_client_vty: remove unnecessary checks
......................................................................

mgcp_client_vty: remove unnecessary checks

The vty always checks if global_mgcp_client_conf exists. (there is also
an assert This check about global_mgcp_client_ctx).
global_mgcp_client_ctx and global_mgcp_client_conf are populated before
the VTY commands are installed. Unleass the caller uses the API wrong
and calls mgcp_client_vty_init with NULL pointers there cannot be a
problem with unpopulated pointers. Lets remove the checks as they are
not needed.

Change-Id: I892d14c588573f76640453cb9c194594289b59f1
Related: SYS#5091
---
M src/libosmo-mgcp-client/mgcp_client_vty.c
1 file changed, 0 insertions(+), 10 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  osmith: Looks good to me, but someone else must approve
  neels: Looks good to me, approved



diff --git a/src/libosmo-mgcp-client/mgcp_client_vty.c b/src/libosmo-mgcp-client/mgcp_client_vty.c
index 1126c5c..9b33eeb 100644
--- a/src/libosmo-mgcp-client/mgcp_client_vty.c
+++ b/src/libosmo-mgcp-client/mgcp_client_vty.c
@@ -42,9 +42,6 @@
       "local bind IPv4 address\n"
       "local bind IPv6 address\n")
 {
-	if (!global_mgcp_client_conf)
-		return CMD_ERR_NOTHING_TODO;
-	OSMO_ASSERT(global_mgcp_client_ctx);
 	osmo_talloc_replace_string(global_mgcp_client_ctx,
 				   (char**)&global_mgcp_client_conf->local_addr,
 				   argv[0]);
@@ -60,8 +57,6 @@
       MGW_STR "local port to connect to MGW from\n"
       "local bind port\n")
 {
-	if (!global_mgcp_client_conf)
-		return CMD_ERR_NOTHING_TODO;
 	global_mgcp_client_conf->local_port = atoi(argv[0]);
 	return CMD_SUCCESS;
 }
@@ -76,9 +71,6 @@
       "remote IPv4 address\n"
       "remote IPv6 address\n")
 {
-	if (!global_mgcp_client_conf)
-		return CMD_ERR_NOTHING_TODO;
-	OSMO_ASSERT(global_mgcp_client_ctx);
 	osmo_talloc_replace_string(global_mgcp_client_ctx,
 				   (char**)&global_mgcp_client_conf->remote_addr,
 				   argv[0]);
@@ -94,8 +86,6 @@
       MGW_STR "remote port to reach the MGW at\n"
       "remote port\n")
 {
-	if (!global_mgcp_client_conf)
-		return CMD_ERR_NOTHING_TODO;
 	global_mgcp_client_conf->remote_port = atoi(argv[0]);
 	return CMD_SUCCESS;
 }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/25029
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I892d14c588573f76640453cb9c194594289b59f1
Gerrit-Change-Number: 25029
Gerrit-PatchSet: 11
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210817/0aa2d817/attachment.htm>


More information about the gerrit-log mailing list