Skip to content

Commit

Permalink
addr: fix bt_addr_str multiple define
Browse files Browse the repository at this point in the history
bug: v/49964

Signed-off-by: fangzhenwei <[email protected]>
  • Loading branch information
Frozen935 committed Jan 16, 2025
1 parent 5194f75 commit 5f83e8d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions framework/common/bt_addr.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,14 @@

#include "bt_addr.h"

const bt_address_t bt_addr_empty = {
static const bt_address_t bt_addr_empty = {
{ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
};
const bt_address_t bt_addr_any = {
{ 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
};

/* remove this unused variable */
// const bt_address_t bt_addr_any = {
// { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }
// };

static char g_bdaddr_str[18];

Expand Down Expand Up @@ -79,7 +81,7 @@ int bt_addr_ba2str(const bt_address_t* addr, char* str)
addr->addr[2], addr->addr[1], addr->addr[0]);
}

char* bt_addr_str(const bt_address_t* addr)
char* bt_addr_bastr(const bt_address_t* addr)
{
if (!addr) {
return NULL;
Expand Down
5 changes: 3 additions & 2 deletions framework/include/bt_addr.h
Original file line number Diff line number Diff line change
Expand Up @@ -162,11 +162,12 @@ int bt_addr_str2ba(const char* str, bt_address_t* addr);
* **Example:**
* @code
* bt_address_t addr = {0x00, 0x11, 0x22, 0x33, 0x44, 0x55};
* printf("Address: %s\n", bt_addr_str(&addr));
* printf("Address: %s\n", bt_addr_bastr(&addr));
* // Output: Address: 00:11:22:33:44:55
* @endcode
*/
char* bt_addr_str(const bt_address_t* addr);
char* bt_addr_bastr(const bt_address_t* addr);
#define bt_addr_str(addr) bt_addr_bastr(addr)


/**
Expand Down

0 comments on commit 5f83e8d

Please sign in to comment.