diff options
author | Anderson Lizardo <anderson.lizardo@openbossa.org> | 2014-01-11 00:47:23 -0400 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2014-01-11 18:56:03 +0200 |
commit | a8b353da809098f91c3e9d62a9563e748ddb07aa (patch) | |
tree | e7f5b02a8809de08477232b4ae44c6bbd88e2a7a /attrib | |
parent | ef97296c20ea305b3214323487c42e727ce7aead (diff) | |
download | bluez-a8b353da809098f91c3e9d62a9563e748ddb07aa.tar.gz |
attrib: Remove unnecessary NULL checks on dec_find_by_type_req()
Just assume that the caller will pass non-NULL pointers as arguments
(which is true for the only current caller of this function).
Diffstat (limited to 'attrib')
-rw-r--r-- | attrib/att.c | 24 |
1 files changed, 9 insertions, 15 deletions
diff --git a/attrib/att.c b/attrib/att.c index 777ef464c..435a26dd9 100644 --- a/attrib/att.c +++ b/attrib/att.c @@ -291,30 +291,24 @@ uint16_t dec_find_by_type_req(const uint8_t *pdu, size_t len, uint16_t *start, if (len < min_len) return 0; + /* Attribute Opcode (1 octet) */ if (pdu[0] != ATT_OP_FIND_BY_TYPE_REQ) return 0; - /* First requested handle number */ - if (start) - *start = att_get_u16(&pdu[1]); - - /* Last requested handle number */ - if (end) - *end = att_get_u16(&pdu[3]); - - /* Always UUID16 */ - if (uuid) - *uuid = att_get_uuid16(&pdu[5]); + /* First requested handle number (2 octets) */ + *start = att_get_u16(&pdu[1]); + /* Last requested handle number (2 octets) */ + *end = att_get_u16(&pdu[3]); + /* 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 && value) + if (valuelen > 0) memcpy(value, pdu + min_len, valuelen); - if (vlen) - *vlen = valuelen; - return len; } |