[MERGED] osmo-bts[master]: cosmetic: lchan_sacch_get: early-exit instead of nested-if

Harald Welte gerrit-no-reply at lists.osmocom.org
Fri Feb 10 12:18:49 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: cosmetic: lchan_sacch_get: early-exit instead of nested-if
......................................................................


cosmetic: lchan_sacch_get: early-exit instead of nested-if

Change-Id: I1fbf7d7f619cc8194c8094cf4a1826b6114f0e11
---
M src/common/sysinfo.c
1 file changed, 4 insertions(+), 4 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/sysinfo.c b/src/common/sysinfo.c
index d0a476d..177ed58 100644
--- a/src/common/sysinfo.c
+++ b/src/common/sysinfo.c
@@ -151,10 +151,10 @@
 	uint32_t tmp;
 
 	for (tmp = lchan->si.last + 1; tmp != lchan->si.last; tmp = (tmp + 1) % _MAX_SYSINFO_TYPE) {
-		if (lchan->si.valid & (1 << tmp)) {
-			lchan->si.last = tmp;
-			return lchan->si.buf[tmp];
-		}
+		if (!(lchan->si.valid & (1 << tmp)))
+			continue;
+		lchan->si.last = tmp;
+		return lchan->si.buf[tmp];
 	}
 	return NULL;
 }

-- 
To view, visit https://gerrit.osmocom.org/1779
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1fbf7d7f619cc8194c8094cf4a1826b6114f0e11
Gerrit-PatchSet: 2
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder


More information about the gerrit-log mailing list