Skip to content

Commit f5b3024

Browse files
committed
replace inet_ntoa with net_addr_ntop
1 parent 7d3b4af commit f5b3024

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

zephyr/subsys/bacnet_datalink/bip-init.c

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -50,21 +50,6 @@ static char ipv4_addr_str[16] = { 0 };
5050
static char ipv4_addr_str[] = "";
5151
#endif
5252

53-
/**
54-
* @brief Return a string representation of an IPv4 address
55-
* @param a - IPv4 address
56-
* @return Pointer to global string
57-
*/
58-
char *inet_ntoa(struct in_addr *a)
59-
{
60-
if (IS_ENABLED(CONFIG_BACNETSTACK_LOG_LEVEL)) {
61-
snprintf(
62-
ipv4_addr_str, sizeof(ipv4_addr_str), "%d.%d.%d.%d", a->s4_addr[0],
63-
a->s4_addr[1], a->s4_addr[2], a->s4_addr[3]);
64-
}
65-
66-
return &ipv4_addr_str[0];
67-
}
6853

6954
/**
7055
* @brief Print the IPv4 address with debug info
@@ -78,7 +63,8 @@ static void debug_print_ipv4(
7863
const unsigned int count)
7964
{
8065
LOG_DBG(
81-
"%s %s:%hu (%u bytes)", str, inet_ntoa((struct in_addr *)&addr),
66+
"%s %s:%hu (%u bytes)", str,
67+
net_addr_ntop(AF_INET, addr, ipv4_addr_str, sizeof(ipv4_addr_str)),
8268
ntohs(port), count);
8369
}
8470

0 commit comments

Comments
 (0)