[PATCH] openbsc[master]: cosmetic: chan_alloc: use switch instead of if cascade

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/.

Neels Hofmeyr gerrit-no-reply at lists.osmocom.org
Mon Dec 5 16:10:20 UTC 2016


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

cosmetic: chan_alloc: use switch instead of if cascade

Preparing cosmetically for a subsequent commit which will add another pchan
kind to be checked, rather use a "switch (pchan) {}".

Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc
---
M openbsc/src/libbsc/chan_alloc.c
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/65/1365/1

diff --git a/openbsc/src/libbsc/chan_alloc.c b/openbsc/src/libbsc/chan_alloc.c
index 0f4d90a..799fbef 100644
--- a/openbsc/src/libbsc/chan_alloc.c
+++ b/openbsc/src/libbsc/chan_alloc.c
@@ -124,7 +124,8 @@
 		 * to check whether a dynamic timeslot is already in TCH/H mode
 		 * and whether one of the two channels is still available.
 		 */
-		if (pchan == GSM_PCHAN_TCH_F_TCH_H_PDCH) {
+		switch (pchan) {
+		case GSM_PCHAN_TCH_F_TCH_H_PDCH:
 			if (ts->dyn.pchan_is != ts->dyn.pchan_want) {
 				/* The TS's mode is being switched. Not
 				 * available anymore/yet. */
@@ -149,7 +150,8 @@
 			} else
 				/* Otherwise this slot is not applicable. */
 				continue;
-		} else {
+
+		default:
 			/* Not a dynamic channel, there is only one pchan kind: */
 			check_subslots = ts_subslots(ts);
 		}

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ie5eb0fa859c4f225616095dc56d52ce0f2dc8bdc
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Neels Hofmeyr <nhofmeyr at sysmocom.de>



More information about the gerrit-log mailing list