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

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Wed Feb 8 18:10:45 UTC 2017


Review at  https://gerrit.osmocom.org/1779

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(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/79/1779/1

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: newchange
Gerrit-Change-Id: I1fbf7d7f619cc8194c8094cf4a1826b6114f0e11
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>


More information about the gerrit-log mailing list