diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2014-01-11 00:47:24 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-01-11 18:56:03 +0200 |
commit | a9249eece7300d4e23ed8c6c5b5f10c5029db750 (patch) | |
tree | 1a2b879a2d9f5adc1c29bc0ad6c8783f4ee1da2e /attrib | |
parent | a8b353da809098f91c3e9d62a9563e748ddb07aa (diff) | |
download | bluez-a9249eece7300d4e23ed8c6c5b5f10c5029db750.tar.gz |
attrib: Remove unnecessary local variables from dec_find_by_type_req()
Use number instead of "min_len", which is easier to review (with help of
the documented parameter sizes).
valuelen is redundant as *vlen can be used directly.
Diffstat (limited to 'attrib')
-rw-r--r-- | attrib/att.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/attrib/att.c b/attrib/att.c index 435a26dd9..d36791860 100644 --- a/attrib/att.c +++ b/attrib/att.c @@ -281,14 +281,10 @@ uint16_t dec_find_by_type_req(const uint8_t *pdu, size_t len, uint16_t *start, uint16_t *end, bt_uuid_t *uuid, uint8_t *value, size_t *vlen) { - size_t valuelen; - uint16_t min_len = sizeof(pdu[0]) + sizeof(*start) + - sizeof(*end) + sizeof(uint16_t); - if (pdu == NULL) return 0; - if (len < min_len) + if (len < 7) return 0; /* Attribute Opcode (1 octet) */ @@ -302,12 +298,10 @@ uint16_t dec_find_by_type_req(const uint8_t *pdu, size_t len, uint16_t *start, /* 16-bit UUID to find (2 octets) */ *uuid = att_get_uuid16(&pdu[5]); - valuelen = len - min_len; - *vlen = valuelen; - /* Attribute value to find */ - if (valuelen > 0) - memcpy(value, pdu + min_len, valuelen); + *vlen = len - 7; + if (*vlen > 0) + memcpy(value, pdu + 7, *vlen); return len; } |