From 614aba391d836645127b90dab7f3ec826d7b574e Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Fri, 4 Sep 2015 16:01:12 +0200 Subject: mgcp: Fix grammar, clean-up return codes Mike's patch included clean-ups I want to apply separately and change them a bit. If we return from an else we don't need to put the else. * Try the E1 trunk first * Then try a local virtual trunk * Fail if none of the above returned --- openbsc/src/libmgcp/mgcp_protocol.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 103897c7f..ab98be1d8 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -427,15 +427,14 @@ static struct mgcp_endpoint *find_endpoint(struct mgcp_config *cfg, const char * char *endptr = NULL; unsigned int gw = INT_MAX; - if (strncmp(mgcp, "ds/e1", 5) == 0) { + if (strncmp(mgcp, "ds/e1", 5) == 0) return find_e1_endpoint(cfg, mgcp); - } else { - gw = strtoul(mgcp, &endptr, 16); - if (gw > 0 && gw < cfg->trunk.number_endpoints && endptr[0] == '@') - return &cfg->trunk.endpoints[gw]; - } - LOGP(DMGCP, LOGL_ERROR, "Not able to find endpoint: '%s'\n", mgcp); + gw = strtoul(mgcp, &endptr, 16); + if (gw > 0 && gw < cfg->trunk.number_endpoints && endptr[0] == '@') + return &cfg->trunk.endpoints[gw]; + + LOGP(DMGCP, LOGL_ERROR, "Not able to find the endpoint: '%s'\n", mgcp); return NULL; } -- cgit v1.2.3