Change in osmo-pcu[master]: sched: Simplify else-if condition

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

pespin gerrit-no-reply at lists.osmocom.org
Mon Apr 26 16:10:33 UTC 2021


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/23909 )


Change subject: sched: Simplify else-if condition
......................................................................

sched: Simplify else-if condition

The code path running into first call of "create_packet_access_reject()"
is a superset condition of the second one, so the second one will never
be hit.

As a result first, this block:
"""
else if (tbf == tbfs->ul_ass && tbf->direction == GPRS_RLCMAC_DL_TBF)
    if (tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ))
        msg = tbfs->ul_ass->create_packet_access_reject();
    else
        msg = tbfs->ul_ass->create_ul_ass(fn, ts);
"""

Can be simplified into:
"""
else if (tbf == tbfs->ul_ass && tbf->direction == GPRS_RLCMAC_DL_TBF &&
	     !tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ))
        msg = tbfs->ul_ass->create_ul_ass(fn, ts);
"""

Next, one can see that previous condition still forces
!tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ) to be always true
if we ever reach that code, so it can be dropped.

Change-Id: I62e2255e28fc4f43fe0a31259ebf18ad00e7e357
---
M src/gprs_rlcmac_sched.cpp
1 file changed, 2 insertions(+), 6 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/09/23909/1

diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index ab7e57e..85c9be8 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -175,12 +175,8 @@
 			 */
 			if (tbf == tbfs->ul_ass && tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ))
 				msg = tbfs->ul_ass->create_packet_access_reject();
-			else if (tbf == tbfs->ul_ass && tbf->direction ==
-					GPRS_RLCMAC_DL_TBF)
-				if (tbf->ul_ass_state_is(GPRS_RLCMAC_UL_ASS_SEND_ASS_REJ))
-					msg = tbfs->ul_ass->create_packet_access_reject();
-				else
-					msg = tbfs->ul_ass->create_ul_ass(fn, ts);
+			else if (tbf == tbfs->ul_ass && tbf->direction == GPRS_RLCMAC_DL_TBF)
+				msg = tbfs->ul_ass->create_ul_ass(fn, ts);
 			else if (tbf == tbfs->dl_ass && tbf->direction == GPRS_RLCMAC_UL_TBF)
 				msg = tbfs->dl_ass->create_dl_ass(fn, ts);
 			else if (tbf == tbfs->ul_ack)

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/23909
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I62e2255e28fc4f43fe0a31259ebf18ad00e7e357
Gerrit-Change-Number: 23909
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210426/2d679c4c/attachment.htm>


More information about the gerrit-log mailing list