Change in libosmo-sccp[master]: sccp: Convert ifelse to switch statement

2020-01-17 Thread pespin
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-MessageType: merged


Change in libosmo-sccp[master]: sccp: Convert ifelse to switch statement

2020-01-17 Thread osmith
osmith has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/16900 )

Change subject: sccp: Convert ifelse to switch statement
..


Patch Set 2: Code-Review+2


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Reviewer: osmith 
Gerrit-Reviewer: pespin 
Gerrit-Comment-Date: Fri, 17 Jan 2020 15:12:21 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmo-sccp[master]: sccp: Convert ifelse to switch statement

2020-01-16 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/libosmo-sccp/+/16900 )

Change subject: sccp: Convert ifelse to switch statement
..


Patch Set 1: Code-Review+1


--
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 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Thu, 16 Jan 2020 20:25:44 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in libosmo-sccp[master]: sccp: Convert ifelse to switch statement

2020-01-16 Thread pespin
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 
Gerrit-MessageType: newchange