diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-09-04 16:01:12 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2015-09-04 16:05:30 +0200 |
commit | 614aba391d836645127b90dab7f3ec826d7b574e (patch) | |
tree | 01ec843247da4e0f9201330f280d0ec51694a023 /openbsc/src/libmgcp/mgcp_protocol.c | |
parent | 79135acbb88c92bbe0214ada4feea53cb12a0ef4 (diff) |
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
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_protocol.c')
-rw-r--r-- | openbsc/src/libmgcp/mgcp_protocol.c | 13 |
1 files 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; } |