[PATCH] osmo-mgw[master]: vty: simplify endpoint allocation

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

dexter gerrit-no-reply at lists.osmocom.org
Fri Nov 10 15:58:09 UTC 2017


Review at  https://gerrit.osmocom.org/4775

vty: simplify endpoint allocation

mgcp_parse_config() uses a helper function allocate_trunk() to
perform the trunk allocation. This helper function only calls
mgcp_endpoints_allocate() and checks the return code.

Call mgcp_endpoints_allocate() directly from mgcp_parse_config()

Change-Id: Iefdc5b905d76d2cd97f26584261fe5cbefb699cf
---
M src/libosmo-mgcp/mgcp_vty.c
1 file changed, 2 insertions(+), 14 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/75/4775/1

diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 7ff1fdd..fcf756b 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -1251,18 +1251,6 @@
 	return 0;
 }
 
-static int allocate_trunk(struct mgcp_trunk_config *trunk)
-{
-	if (mgcp_endpoints_allocate(trunk) != 0) {
-		LOGP(DLMGCP, LOGL_ERROR,
-		     "Failed to allocate %d endpoints on trunk %d.\n",
-		     trunk->number_endpoints, trunk->trunk_nr);
-		return -1;
-	}
-
-	return 0;
-}
-
 int mgcp_parse_config(const char *config_file, struct mgcp_config *cfg,
 		      enum mgcp_role role)
 {
@@ -1286,14 +1274,14 @@
 		return -1;
 	}
 
-	if (allocate_trunk(&g_cfg->trunk) != 0) {
+	if (mgcp_endpoints_allocate(&g_cfg->trunk) != 0) {
 		LOGP(DLMGCP, LOGL_ERROR,
 		     "Failed to initialize the virtual trunk.\n");
 		return -1;
 	}
 
 	llist_for_each_entry(trunk, &g_cfg->trunks, entry) {
-		if (allocate_trunk(trunk) != 0) {
+		if (mgcp_endpoints_allocate(trunk) != 0) {
 			LOGP(DLMGCP, LOGL_ERROR,
 			     "Failed to initialize E1 trunk %d.\n",
 			     trunk->trunk_nr);

-- 
To view, visit https://gerrit.osmocom.org/4775
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Iefdc5b905d76d2cd97f26584261fe5cbefb699cf
Gerrit-PatchSet: 1
Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Owner: dexter <pmaier at sysmocom.de>



More information about the gerrit-log mailing list