diff --git a/include/bluetooth/uuid.h b/include/bluetooth/uuid.h index bb40e95317e..1b25a13fa6a 100644 --- a/include/bluetooth/uuid.h +++ b/include/bluetooth/uuid.h @@ -471,7 +471,10 @@ int bt_uuid_cmp(const struct bt_uuid *u1, const struct bt_uuid *u2); */ void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len); -/** @brief Convert Bluetooth UUID to string in place. +const char *bt_uuid_str_real(const struct bt_uuid *uuid); + +/** @def bt_uuid_str + * @brief Convert Bluetooth UUID to string in place. * * Converts Bluetooth UUID to string in place. UUID has to be in 16 bits or * 128 bits format. @@ -480,7 +483,7 @@ void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len); * * @return String representation of the UUID given */ -const char *bt_uuid_str(const struct bt_uuid *uuid); +#define bt_uuid_str(_uuid) log_strdup(bt_uuid_str_real(_uuid)) #else static inline void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len) diff --git a/subsys/bluetooth/host/uuid.c b/subsys/bluetooth/host/uuid.c index df5c427dd1a..e6304429c15 100644 --- a/subsys/bluetooth/host/uuid.c +++ b/subsys/bluetooth/host/uuid.c @@ -110,7 +110,7 @@ void bt_uuid_to_str(const struct bt_uuid *uuid, char *str, size_t len) } } -const char *bt_uuid_str(const struct bt_uuid *uuid) +const char *bt_uuid_str_real(const struct bt_uuid *uuid) { static char str[37];