[MERGED] osmo-bsc[master]: compiler warning: chan_compat_with_mode(): clearly handle al...

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
Mon Mar 5 10:46:29 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: compiler warning: chan_compat_with_mode(): clearly handle all enum vals
......................................................................


compiler warning: chan_compat_with_mode(): clearly handle all enum vals

Change-Id: I5b3a9a9f0e88b42eed1591632dee1fa00e79f3a3
---
M src/libbsc/bsc_api.c
1 file changed, 7 insertions(+), 19 deletions(-)

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



diff --git a/src/libbsc/bsc_api.c b/src/libbsc/bsc_api.c
index d5aaf9b..d792b58 100644
--- a/src/libbsc/bsc_api.c
+++ b/src/libbsc/bsc_api.c
@@ -423,8 +423,9 @@
 		case GSM_LCHAN_TCH_H:
 		case GSM_LCHAN_SDCCH:
 			return 1;
+		default:
+			return 0;
 		}
-		break;
 	case GSM48_CMODE_SPEECH_V1:
 	case GSM48_CMODE_SPEECH_AMR:
 	case GSM48_CMODE_DATA_3k6:
@@ -433,33 +434,20 @@
 		 * an explicit override by the 'full_rate' argument */
 		switch (lchan->type) {
 		case GSM_LCHAN_TCH_F:
-			if (full_rate)
-				return 1;
-			else
-				return 0;
-			break;
+			return full_rate ? 1 : 0;
 		case GSM_LCHAN_TCH_H:
-			if (full_rate)
-				return 0;
-			else
-				return 1;
-			break;
+			return full_rate ? 0 : 1;
 		default:
 			return 0;
 		}
-		break;
 	case GSM48_CMODE_DATA_12k0:
 	case GSM48_CMODE_DATA_14k5:
 	case GSM48_CMODE_SPEECH_EFR:
 		/* these services all explicitly require a TCH/F */
-		if (lchan->type == GSM_LCHAN_TCH_F)
-			return 1;
-		else
-			return 0;
-		break;
+		return (lchan->type == GSM_LCHAN_TCH_F) ? 1 : 0;
+	default:
+		return 0;
 	}
-
-	return 0;
 }
 
 /**

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I5b3a9a9f0e88b42eed1591632dee1fa00e79f3a3
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bsc
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