From fb9303c610f318dfcaa5a0e2a1d54cd2deb22d8c Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Mon, 7 Mar 2022 11:34:28 +0100 Subject: [PATCH] gtp: Use switch statement in gtp_create_pdp_ind() Double if had to be changed to if-else anyway, so let's simply use a switch statement. Change-Id: I91e8722947e58776742521d89abef8ae7584cb25 --- gtp/gtp.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/gtp/gtp.c b/gtp/gtp.c index 829d2d2..3051255 100644 --- a/gtp/gtp.c +++ b/gtp/gtp.c @@ -1554,7 +1554,8 @@ int gtp_create_pdp_ind(struct gsn_t *gsn, int version, GTPCAUSE_INVALID_MESSAGE); } - if (version == 1) { + switch (version) { + case 1: /* Linked NSAPI (conditional) */ /* If included this is the Secondary PDP Context Activation Procedure */ /* In secondary activation IMSI is not included, so the context must be */ @@ -1646,9 +1647,9 @@ int gtp_create_pdp_ind(struct gsn_t *gsn, int version, if (gtpie_gettlv(ie, GTPIE_TFT, 0, &pdp->tft.l, &pdp->tft.v, sizeof(pdp->tft.v))) { } - } - /* if (version == 1) */ - if (version == 0) { + break; /* version 1 */ + + case 0: if (gtpie_gettv0(ie, GTPIE_QOS_PROFILE0, 0, pdp->qos_req0, sizeof(pdp->qos_req0))) { gsn->missing++; @@ -1671,6 +1672,7 @@ int gtp_create_pdp_ind(struct gsn_t *gsn, int version, return gtp_create_pdp_resp(gsn, version, pdp, GTPCAUSE_MAN_IE_MISSING); } + break; } /* SGSN address for signalling (mandatory) */