Skip to contentSkip to conversation

Remove unnecessary casting in thermometer plugin

PATCH Applied Santiago Carot-Nemesio 2 participants 2 messages Oct 31, 2011 – Nov 1, 2011 Bluetooth drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Remove unnecessary casting in thermometer plugin

---
 thermometer/thermometer.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
thermometer/thermometer.c +2 -4
index 0d85102..8f0a5ea 100644
@@ -200,7 +200,7 @@ static void read_interval_cb(guint8 status, const guint8 *pdu, guint16 len,
 {
 	struct characteristic *ch = user_data;
 	uint8_t value[ATT_MAX_MTU];
-	uint16_t *p, interval;
+	uint16_t interval;
 	int vlen;
 
 	if (status != 0) {
@@ -219,9 +219,7 @@ static void read_interval_cb(guint8 status, const guint8 *pdu, guint16 len,
 		return;
 	}
 
-	p = (uint16_t *) value;
-	interval = btohs(bt_get_unaligned(p));
-
+	interval = att_get_u16(&value[0]);
 	change_property(ch->t, "Interval", &interval);
 }
 
Signature · 1 line
1.7.7.1
#1 lore raw

Hi Santiago,

Quoted 3 lines · Santiago Carot-Nemesio
---
 thermometer/thermometer.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)

Applied. Thanks.

Johan