[MERGED] osmo-bsc[master]: cosmetic: Remove data/len variables in bssmap_handle_assignm...

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
Sun Jan 28 09:42:34 UTC 2018


Harald Welte has submitted this change and it was merged.

Change subject: cosmetic: Remove data/len variables in bssmap_handle_assignm_req()
......................................................................


cosmetic: Remove data/len variables in bssmap_handle_assignm_req()

There's nothing wrong with passing the TLVP_VAL/TLVP_LEN directly into
the gsm0808 decoder functions, let's avoid variables that get assigned
and used only once - particularly with such generic names.

Change-Id: I8557b4a9ff4de28b76c7d618631a4700176a8669
---
M src/osmo-bsc/osmo_bsc_bssap.c
1 file changed, 6 insertions(+), 11 deletions(-)

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



diff --git a/src/osmo-bsc/osmo_bsc_bssap.c b/src/osmo-bsc/osmo_bsc_bssap.c
index 67ff230..586657f 100644
--- a/src/osmo-bsc/osmo_bsc_bssap.c
+++ b/src/osmo-bsc/osmo_bsc_bssap.c
@@ -744,8 +744,6 @@
 	struct gsm0808_speech_codec_list scl;
 	struct gsm0808_speech_codec_list *scl_ptr = NULL;
 	int rc;
-	const uint8_t *data;
-	char len;
 
 	if (!conn->conn) {
 		LOGP(DMSC, LOGL_ERROR,
@@ -771,9 +769,8 @@
 		multiplex = (conn->user_plane.cic & ~0x1f) >> 5;
 	} else if (TLVP_PRESENT(&tp, GSM0808_IE_AOIP_TRASP_ADDR)) {
 		/* Decode AoIP transport address element */
-		data = TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR);
-		len = TLVP_LEN(&tp, GSM0808_IE_AOIP_TRASP_ADDR);
-		rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, data, len);
+		rc = gsm0808_dec_aoip_trasp_addr(&rtp_addr, TLVP_VAL(&tp, GSM0808_IE_AOIP_TRASP_ADDR),
+						 TLVP_LEN(&tp, GSM0808_IE_AOIP_TRASP_ADDR));
 		if (rc < 0) {
 			LOGP(DMSC, LOGL_ERROR,
 			     "Unable to decode aoip transport address.\n");
@@ -796,9 +793,8 @@
 		}
 
 		/* Decode Speech Codec list */
-		data = TLVP_VAL(&tp, GSM0808_IE_SPEECH_CODEC_LIST);
-		len = TLVP_LEN(&tp, GSM0808_IE_SPEECH_CODEC_LIST);
-		rc = gsm0808_dec_speech_codec_list(&scl, data, len);
+		rc = gsm0808_dec_speech_codec_list(&scl, TLVP_VAL(&tp, GSM0808_IE_SPEECH_CODEC_LIST),
+						   TLVP_LEN(&tp, GSM0808_IE_SPEECH_CODEC_LIST));
 		if (rc < 0) {
 			LOGP(DMSC, LOGL_ERROR,
 			     "Unable to decode speech codec list\n");
@@ -808,9 +804,8 @@
 	}
 
 	/* Decode Channel Type element */
-	data = TLVP_VAL(&tp, GSM0808_IE_CHANNEL_TYPE);
-	len = TLVP_LEN(&tp, GSM0808_IE_CHANNEL_TYPE);
-	rc = gsm0808_dec_channel_type(&ct, data, len);
+	rc = gsm0808_dec_channel_type(&ct,  TLVP_VAL(&tp, GSM0808_IE_CHANNEL_TYPE),
+				      TLVP_LEN(&tp, GSM0808_IE_CHANNEL_TYPE));
 	if (rc < 0) {
 		LOGP(DMSC, LOGL_ERROR, "unable to decode channel type.\n");
 		goto reject;

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I8557b4a9ff4de28b76c7d618631a4700176a8669
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list