pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-sccp/+/16900 )
Change subject: sccp: Convert ifelse to switch statement ...................................................................... sccp: Convert ifelse to switch statement Change-Id: I1f3129f5b949fc70913e8103ef17c696002b8ed2 --- M src/sccp2sua.c 1 file changed, 8 insertions(+), 7 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmo-sccp refs/changes/00/16900/1 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 @@ 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 @@ 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; -- To view, visit https://gerrit.osmocom.org/c/libosmo-sccp/+/16900 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmo-sccp Gerrit-Branch: master Gerrit-Change-Id: I1f3129f5b949fc70913e8103ef17c696002b8ed2 Gerrit-Change-Number: 16900 Gerrit-PatchSet: 1 Gerrit-Owner: pespin <pes...@sysmocom.de> Gerrit-MessageType: newchange