pespin has submitted this change. ( 
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(-)

Approvals:
  Jenkins Builder: Verified
  osmith: Looks good to me, approved
  laforge: Looks good to me, but someone else must approve



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: 2
Gerrit-Owner: pespin <pes...@sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <lafo...@osmocom.org>
Gerrit-Reviewer: osmith <osm...@sysmocom.de>
Gerrit-Reviewer: pespin <pes...@sysmocom.de>
Gerrit-MessageType: merged

Reply via email to