Change in osmo-mgw[master]: mgcp_trunk: remove double check

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/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Jul 16 11:57:45 UTC 2020


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

Change subject: mgcp_trunk: remove double check
......................................................................

mgcp_trunk: remove double check

At the moment, the trunk prefix is checked twice. Lets re-arange the
code a bit so that the check only happens once.

Change-Id: I91fb8cf6e3b077ba8f18fdbcd071275c6fd7cacd
Related: OS#2547
---
M src/libosmo-mgcp/mgcp_trunk.c
1 file changed, 2 insertions(+), 6 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified

Objections:
  neels: I would prefer this is not merged as is



diff --git a/src/libosmo-mgcp/mgcp_trunk.c b/src/libosmo-mgcp/mgcp_trunk.c
index e41ed0e..f3785cd 100644
--- a/src/libosmo-mgcp/mgcp_trunk.c
+++ b/src/libosmo-mgcp/mgcp_trunk.c
@@ -159,13 +159,9 @@
 		return mgcp_trunk_by_num(cfg, MGCP_TRUNK_VIRTUAL, MGCP_VIRT_TRUNK_ID);
 	}
 
-	prefix_len = sizeof(MGCP_ENDPOINT_PREFIX_E1_TRUNK) - 1;
-	if (strncmp(epname, MGCP_ENDPOINT_PREFIX_E1_TRUNK, prefix_len) == 0) {
-		trunk_nr = e1_trunk_nr_from_epname(epname);
-		if (trunk_nr < 0)
-			return NULL;
+	trunk_nr = e1_trunk_nr_from_epname(epname);
+	if (trunk_nr > 0)
 		return mgcp_trunk_by_num(cfg, MGCP_TRUNK_E1, trunk_nr);
-	}
 
 	/* Earlier versions of osmo-mgw were accepting endpoint names
 	 * without trunk prefix. This is normally not allowed, each MGCP

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

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I91fb8cf6e3b077ba8f18fdbcd071275c6fd7cacd
Gerrit-Change-Number: 19119
Gerrit-PatchSet: 7
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr 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/20200716/68c473c4/attachment.htm>


More information about the gerrit-log mailing list