Bluetooth: Change bt_buf_add return type to 'void *'

Almost all callers of bt_buf_add end up having to do explicit type
casts of the return value since 'uint8_t *' rarely fits what's needed.
Changing the return type to 'void *' removes this extra type casting
need and makes the API friendlier to its users.

Change-Id: I6a79605006153b6d09f0d662a051cb599af68c37
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2015-05-18 10:14:22 +03:00 committed by Anas Nashif
commit d6a03600b2
2 changed files with 4 additions and 4 deletions

View file

@ -98,7 +98,7 @@ void bt_buf_put(struct bt_buf *buf);
struct bt_buf *bt_buf_hold(struct bt_buf *buf);
/* Prepare data to be added at the end of the buffer */
uint8_t *bt_buf_add(struct bt_buf *buf, size_t len);
void *bt_buf_add(struct bt_buf *buf, size_t len);
/* Push data to the beginning of the buffer */
uint8_t *bt_buf_push(struct bt_buf *buf, size_t len);

View file

@ -130,10 +130,10 @@ void bt_buf_put(struct bt_buf *buf)
return;
}
cp = (void *)bt_buf_add(buf, sizeof(*cp));
cp = bt_buf_add(buf, sizeof(*cp));
cp->num_handles = sys_cpu_to_le16(1);
hc = (void *)bt_buf_add(buf, sizeof(*hc));
hc = bt_buf_add(buf, sizeof(*hc));
hc->handle = sys_cpu_to_le16(handle);
hc->count = sys_cpu_to_le16(1);
@ -147,7 +147,7 @@ struct bt_buf *bt_buf_hold(struct bt_buf *buf)
return buf;
}
uint8_t *bt_buf_add(struct bt_buf *buf, size_t len)
void *bt_buf_add(struct bt_buf *buf, size_t len)
{
uint8_t *tail = buf->data + buf->len;
#if defined(CONFIG_BLUETOOTH_DEBUG_BUF)