Skip to content

Commit

Permalink
nl-base-utils: add _nl_addr_family_to_size() helper
Browse files Browse the repository at this point in the history
  • Loading branch information
thom311 committed Nov 29, 2023
1 parent cd4016b commit 057aac1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions include/base/nl-base-utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -663,6 +663,17 @@ static inline void *_nl_memdup(const void *ptr, size_t len)

/*****************************************************************************/

static inline size_t _nl_addr_family_to_size(int addr_family)
{
if (addr_family == AF_INET)
return sizeof(in_addr_t);
if (addr_family == AF_INET6)
return sizeof(struct in6_addr);
return 0;
}

/*****************************************************************************/

typedef union {
in_addr_t addr4;
struct in_addr a4;
Expand Down

0 comments on commit 057aac1

Please sign in to comment.