aboutsummaryrefslogtreecommitdiffstats
path: root/src/gprs_rlcmac_sched.cpp
diff options
context:
space:
mode:
authorPau Espin Pedrol <pespin@sysmocom.de>2021-04-26 18:02:52 +0200
committerPau Espin Pedrol <pespin@sysmocom.de>2021-04-26 18:02:54 +0200
commit34f61af3d041ee38262095e630758652e16b93fe (patch)
treedd5950e9990f2885bc44948c09c46cd9cc4a4da1 /src/gprs_rlcmac_sched.cpp
parent2ab840a1faaa56a026948c7d7b9bd9c1dcdb2d1c (diff)
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
Diffstat (limited to 'src/gprs_rlcmac_sched.cpp')
-rw-r--r--src/gprs_rlcmac_sched.cpp8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp
index ab7e57ec..85c9be81 100644
--- a/src/gprs_rlcmac_sched.cpp
+++ b/src/gprs_rlcmac_sched.cpp
@@ -175,12 +175,8 @@ static struct msgb *sched_select_ctrl_msg(struct gprs_rlcmac_pdch *pdch, uint32_
*/
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)