From 060b39223e030d25d6bfbe2486469c69e4209b7c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Thu, 16 Jan 2020 18:53:18 +0100 Subject: sccp: Convert ifelse to switch statement Change-Id: I1f3129f5b949fc70913e8103ef17c696002b8ed2 --- src/sccp2sua.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sccp2sua.c b/src/sccp2sua.c index 1106888..e68662f 100644 --- a/src/sccp2sua.c +++ b/src/sccp2sua.c @@ -712,13 +712,14 @@ static struct xua_msg *sccp_to_xua_opt(struct msgb *msg, uint8_t *ptr_opt, struc oneopt = opt_start; while (oneopt < msg->tail) { - uint8_t opt_type = oneopt[0]; + enum sccp_parameter_name_codes opt_type = oneopt[0]; + uint8_t opt_len; + uint16_t opt_len16; - if (opt_type == SCCP_PNC_END_OF_OPTIONAL) + switch (opt_type) { + case SCCP_PNC_END_OF_OPTIONAL: return xua; - - if (opt_type == SCCP_PNC_LONG_DATA) { - uint16_t opt_len16; + case SCCP_PNC_LONG_DATA: /* two byte length field */ if (oneopt + 2 > msg->tail) return NULL; @@ -727,8 +728,8 @@ static struct xua_msg *sccp_to_xua_opt(struct msgb *msg, uint8_t *ptr_opt, struc return NULL; xua_msg_add_sccp_opt(xua, opt_type, opt_len16, oneopt+3); oneopt += 3 + opt_len16; - } else { - uint8_t opt_len; + break; + default: /* one byte length field */ if (oneopt + 1 > msg->tail) return NULL; -- cgit v1.2.3