Bluetooth: Convert string helpers to use log_strdup

This reduces the multiple buffer requirement to a single buffer.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
Johan Hedberg 2018-10-17 14:09:40 +03:00 committed by Carles Cufí
commit cd4cf4e580
3 changed files with 16 additions and 45 deletions

View file

@ -92,15 +92,13 @@ static inline __printf_like(1, 2) void _bt_log_dummy(const char *fmt, ...) {};
k_oops(); \
}
/* This helper is only available when BT_DEBUG is enabled */
const char *bt_hex(const void *buf, size_t len);
/* These helpers are only safe to be called from internal threads as they're
* not multi-threading safe
*/
const char *bt_addr_str(const bt_addr_t *addr);
const char *bt_addr_le_str(const bt_addr_le_t *addr);
const char *bt_hex_real(const void *buf, size_t len);
const char *bt_addr_str_real(const bt_addr_t *addr);
const char *bt_addr_le_str_real(const bt_addr_le_t *addr);
#define bt_hex(buf, len) log_strdup(bt_hex_real(buf, len))
#define bt_addr_str(addr) log_strdup(bt_addr_str_real(addr))
#define bt_addr_le_str(addr) log_strdup(bt_addr_le_str_real(addr))
#ifdef __cplusplus
}