fixeria has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-gprs/+/35861?usp=email )

Change subject: rlcmac: refactor gprs_rlcmac_rlc_ul_window_move_window()
......................................................................

rlcmac: refactor gprs_rlcmac_rlc_ul_window_move_window()

* drop unused variable 'i' (fixes -Wunused-but-set-variable)
* reduce nesting in the for-loop

Change-Id: Ic0efd2f84a17d287b73261c102bca84e8274bb2a
---
M src/rlcmac/rlc_window_ul.c
1 file changed, 18 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  pespin: Looks good to me, approved




diff --git a/src/rlcmac/rlc_window_ul.c b/src/rlcmac/rlc_window_ul.c
index af1c32b..e8c07e6 100644
--- a/src/rlcmac/rlc_window_ul.c
+++ b/src/rlcmac/rlc_window_ul.c
@@ -291,18 +291,16 @@
 unsigned int gprs_rlcmac_rlc_ul_window_move_window(struct 
gprs_rlcmac_rlc_ul_window *ulw)
 {
        struct gprs_rlcmac_rlc_window *w = rlc_ulw_as_w(ulw);
-       unsigned int i;
-       uint16_t bsn;
        unsigned int moved = 0;
+       uint16_t bsn;

-       for (i = 0, bsn = gprs_rlcmac_rlc_ul_window_v_a(ulw);
+       for (bsn = gprs_rlcmac_rlc_ul_window_v_a(ulw);
             bsn != gprs_rlcmac_rlc_ul_window_v_s(ulw);
-            i++, bsn = gprs_rlcmac_rlc_window_mod_sns_bsn(w, bsn + 1)) {
-               if (gprs_rlcmac_rlc_v_b_is_acked(&ulw->v_b, bsn)) {
-                       gprs_rlcmac_rlc_v_b_mark_invalid(&ulw->v_b, bsn);
-                       moved += 1;
-               } else
+            bsn = gprs_rlcmac_rlc_window_mod_sns_bsn(w, bsn + 1)) {
+               if (!gprs_rlcmac_rlc_v_b_is_acked(&ulw->v_b, bsn))
                        break;
+               moved += 1;
+               gprs_rlcmac_rlc_v_b_mark_invalid(&ulw->v_b, bsn);
        }

        return moved;

--
To view, visit https://gerrit.osmocom.org/c/libosmo-gprs/+/35861?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-gprs
Gerrit-Branch: master
Gerrit-Change-Id: Ic0efd2f84a17d287b73261c102bca84e8274bb2a
Gerrit-Change-Number: 35861
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to