summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2020-01-16 18:53:18 +0100
committerPau Espin Pedrol <pespin@sysmocom.de>2020-01-17 14:38:26 +0100
commit060b39223e030d25d6bfbe2486469c69e4209b7c (patch)
treea227f5aeeaff866aba1c41f9ea377d15c1670687
parent4b3cbccae70c1c82b0896ab07c2d90d9a63e4d36 (diff)
sccp: Convert ifelse to switch statement
-rw-r--r--src/sccp2sua.c15
1 files changed, 8 insertions, 7 deletions
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;