From d6b913fc39d59a4a5fddca626840361e55db1b55 Mon Sep 17 00:00:00 2001 From: Pau Espin Pedrol Date: Tue, 15 Dec 2020 18:55:16 +0100 Subject: [PATCH] sched: Convert code handling next_list array to be size independant Change-Id: Id209fe66f85501437a79f7ca0c8e3cf816177611 --- src/gprs_rlcmac_sched.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/gprs_rlcmac_sched.cpp b/src/gprs_rlcmac_sched.cpp index 6505425c..e6f71763 100644 --- a/src/gprs_rlcmac_sched.cpp +++ b/src/gprs_rlcmac_sched.cpp @@ -164,16 +164,16 @@ static struct msgb *sched_select_ctrl_msg( { struct msgb *msg = NULL; struct gprs_rlcmac_tbf *tbf = NULL; - struct gprs_rlcmac_tbf *next_list[3] = { tbfs->ul_ass, - tbfs->dl_ass, - tbfs->ul_ack }; + struct gprs_rlcmac_tbf *next_list[] = { tbfs->ul_ass, + tbfs->dl_ass, + tbfs->ul_ack }; /* Send Packet Application Information first (ETWS primary notifications) */ msg = sched_app_info(tbfs->dl_ass); if (!msg) { for (size_t i = 0; i < ARRAY_SIZE(next_list); ++i) { - tbf = next_list[(pdch->next_ctrl_prio + i) % 3]; + tbf = next_list[(pdch->next_ctrl_prio + i) % ARRAY_SIZE(next_list)]; if (!tbf) continue; @@ -201,8 +201,7 @@ static struct msgb *sched_select_ctrl_msg( continue; } - pdch->next_ctrl_prio += 1; - pdch->next_ctrl_prio %= 3; + pdch->next_ctrl_prio = (pdch->next_ctrl_prio + 1) % ARRAY_SIZE(next_list); break; } }