mgcp_client: get rid of magic numbers for E1 slots

use NUM_E1_TS-1 instead of 31 in relation of E1 timeslot count

Change-Id: Iee134d70f05883fcd2e58e0b9c78ed70aea16695
This commit is contained in:
Philipp Maier 2020-11-26 22:21:11 +01:00 committed by laforge
parent 6e2795bfbf
commit 92a73cd637
2 changed files with 4 additions and 1 deletions

View File

@ -9,6 +9,7 @@ AM_CFLAGS = \
-Wall \
$(LIBOSMOCORE_CFLAGS) \
$(LIBOSMOVTY_CFLAGS) \
$(LIBOSMOABIS_CFLAGS) \
$(COVERAGE_CFLAGS) \
$(NULL)

View File

@ -30,6 +30,8 @@
#include <osmocom/mgcp_client/mgcp_client.h>
#include <osmocom/mgcp_client/mgcp_client_internal.h>
#include <osmocom/abis/e1_input.h>
#include <netinet/in.h>
#include <arpa/inet.h>
@ -957,7 +959,7 @@ const char *mgcp_client_e1_epname(void *ctx, const struct mgcp_client *mgcp, uin
/* An E1 line has a maximum of 32 timeslots, while the first (ts=0) is
* reserverd for framing and alignment, so we can not use it here. */
if (ts == 0 || ts > 31) {
if (ts == 0 || ts > NUM_E1_TS-1) {
LOGP(DLMGCP, LOGL_ERROR,
"Cannot compose MGCP e1-endpoint name (%s), E1-timeslot number (%u) is invalid!\n", epname, ts);
talloc_free(epname);