From ae73d2b16f8c80afd60d37a8b7d60773c207ee35 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Sun, 1 Apr 2018 20:58:08 +0200 Subject: [PATCH] cosmetic: rx_bssmap: read message type once into local var Instead of referencing msg->l3h[0] all the time, use local variable msg_type. Related: OS#3122 Change-Id: If70c9fa00edd462d3470bded6eb2c6521e4d9234 --- src/libmsc/a_iface_bssap.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/libmsc/a_iface_bssap.c b/src/libmsc/a_iface_bssap.c index 3c1bcc878..743814cd3 100644 --- a/src/libmsc/a_iface_bssap.c +++ b/src/libmsc/a_iface_bssap.c @@ -554,11 +554,13 @@ static int rx_bssmap(struct osmo_sccp_user *scu, const struct a_conn_info *a_con struct gsm_subscriber_connection *conn; struct tlv_parsed tp; int rc; + uint8_t msg_type; if (msgb_l3len(msg) < 1) { LOGP(DBSSAP, LOGL_NOTICE, "Error: No data received -- discarding message!\n"); return -1; } + msg_type = msg->l3h[0]; rc = tlv_parse(&tp, gsm0808_att_tlvdef(), msg->l3h + 1, msgb_l3len(msg) - 1, 0, 0); if (rc < 0) { @@ -568,7 +570,7 @@ static int rx_bssmap(struct osmo_sccp_user *scu, const struct a_conn_info *a_con } /* Only message types allowed without a 'conn' */ - switch (msg->l3h[0]) { + switch (msg_type) { case BSS_MAP_MSG_COMPLETE_LAYER_3: return bssmap_rx_l3_compl(scu, a_conn_info, msg, &tp); case BSS_MAP_MSG_CLEAR_COMPLETE: @@ -583,9 +585,9 @@ static int rx_bssmap(struct osmo_sccp_user *scu, const struct a_conn_info *a_con return -EINVAL; } - LOGPCONN(conn, LOGL_DEBUG, "Rx BSSMAP DT1 %s\n", gsm0808_bssmap_name(msg->l3h[0])); + LOGPCONN(conn, LOGL_DEBUG, "Rx BSSMAP DT1 %s\n", gsm0808_bssmap_name(msg_type)); - switch (msg->l3h[0]) { + switch (msg_type) { case BSS_MAP_MSG_CLEAR_RQST: return bssmap_rx_clear_rqst(conn, msg, &tp); case BSS_MAP_MSG_CLASSMARK_UPDATE: @@ -601,7 +603,7 @@ static int rx_bssmap(struct osmo_sccp_user *scu, const struct a_conn_info *a_con case BSS_MAP_MSG_ASSIGMENT_COMPLETE: return bssmap_rx_ass_compl(conn, msg, &tp); default: - LOGPCONN(conn, LOGL_ERROR, "Unimplemented msg type: %s\n", gsm0808_bssmap_name(msg->l3h[0])); + LOGPCONN(conn, LOGL_ERROR, "Unimplemented msg type: %s\n", gsm0808_bssmap_name(msg_type)); return -EINVAL; }