From c15d5cc2303aef3d4417453b680d42a69ff28fb0 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 24 Nov 2013 22:56:53 +0100 Subject: tbf/rlc: Remove the side-effect from the loop. --- src/tbf.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/tbf.cpp b/src/tbf.cpp index aab65863..5f5ea33b 100644 --- a/src/tbf.cpp +++ b/src/tbf.cpp @@ -1618,19 +1618,20 @@ int gprs_rlcmac_tbf::rcv_data_block_acknowledged(const uint8_t *data, size_t len this->dir.ul.window.v_r()); } - #warning "Move to TBF and remove the index side effect.." /* Raise V(Q) if possible, and retrieve LLC frames from blocks. * This is looped until there is a gap (non received block) or * the window is empty.*/ - while (this->dir.ul.window.v_q() != this->dir.ul.window.v_r() && this->dir.ul.v_n. - is_received(index = this->dir.ul.window.v_q() & mod_sns_half)) { + while (this->dir.ul.window.v_q() != this->dir.ul.window.v_r()) { + index = dir.ul.window.v_q() & mod_sns_half; + if (!dir.ul.v_n.is_received(index)) + break; LOGP(DRLCMACUL, LOGL_DEBUG, "- Taking block %d out, raising " - "V(Q) to %d\n", this->dir.ul.window.v_q(), - (this->dir.ul.window.v_q() + 1) & mod_sns); + "V(Q) to %d\n", dir.ul.window.v_q(), + (dir.ul.window.v_q() + 1) & mod_sns); /* get LLC data from block */ - this->assemble_forward_llc(&m_rlc.blocks[index]); + assemble_forward_llc(&m_rlc.blocks[index]); /* raise V(Q), because block already received */ - this->dir.ul.window.increment_q(1); + dir.ul.window.increment_q(1); } /* Check CV of last frame in buffer */ -- cgit v1.2.3