[MERGED] openbsc[master]: pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu May 25 14:43:17 UTC 2017


Harald Welte has submitted this change and it was merged.

Change subject: pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for array iteration
......................................................................


pcu_sock: get rid of magic numbers and use ARRAY_SIZE() for array iteration

Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29
---
M openbsc/src/libbsc/pcu_sock.c
1 file changed, 3 insertions(+), 3 deletions(-)

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



diff --git a/openbsc/src/libbsc/pcu_sock.c b/openbsc/src/libbsc/pcu_sock.c
index 0f3dc1b..e713b08 100644
--- a/openbsc/src/libbsc/pcu_sock.c
+++ b/openbsc/src/libbsc/pcu_sock.c
@@ -211,7 +211,7 @@
 	info_ind->initial_mcs = rlcc->initial_mcs;
 
 	/* NSVC */
-	for (i = 0; i < 2; i++) {
+	for (i = 0; i < ARRAY_SIZE(info_ind->nsvci); i++) {
 		nsvc = &bts->gprs.nsvc[i];
 		info_ind->nsvci[i] = nsvc->nsvci;
 		info_ind->local_port[i] = nsvc->local_port;
@@ -219,13 +219,13 @@
 		info_ind->remote_ip[i] = nsvc->remote_ip;
 	}
 
-	for (i = 0; i < 8; i++) {
+	for (i = 0; i < ARRAY_SIZE(info_ind->trx); i++) {
 		trx = gsm_bts_trx_num(bts, i);
 		if (!trx)
 			break;
 		info_ind->trx[i].pdch_mask = 0;
 		info_ind->trx[i].arfcn = trx->arfcn;
-		for (j = 0; j < 8; j++) {
+		for (j = 0; j < ARRAY_SIZE(trx->ts); j++) {
 			ts = &trx->ts[j];
 			if (ts->mo.nm_state.operational == NM_OPSTATE_ENABLED
 			    && ts_should_be_pdch(ts)) {

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I602b581fab67b3a1c3c03c73a3a99e9afd564e29
Gerrit-PatchSet: 2
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: lynxis lazus <lynxis at fe80.eu>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list