Skip to content

Commit d0df530

Browse files
rsalvetiAnas Nashif
authored andcommitted
net: udp: replace net_udp_get/set_hdr macros with static inline
Replace net_udp_get_hdr and net_udp_set_hdr macros with static inline function definitions to avoid unused variable build warnings when NET_UDP is not defined. This fixes the following warning: subsys/net/ip/6lo.c: In function 'compress_IPHC_header': subsys/net/ip/6lo.c:759:22: warning: unused variable 'hdr' [-Wunused-variable] struct net_udp_hdr hdr, *udp; ^~~ Signed-off-by: Ricardo Salveti <[email protected]>
1 parent 9147b53 commit d0df530

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

include/net/udp.h

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,19 @@ struct net_udp_hdr *net_udp_set_hdr(struct net_pkt *pkt,
6666
struct net_udp_hdr *hdr);
6767

6868
#else
69-
#define net_udp_get_hdr(pkt, frag) NULL
70-
#define net_udp_set_hdr(pkt, frag) NULL
69+
70+
static inline struct net_udp_hdr *net_udp_get_hdr(struct net_pkt *pkt,
71+
struct net_udp_hdr *hdr)
72+
{
73+
return NULL;
74+
}
75+
76+
static inline struct net_udp_hdr *net_udp_set_hdr(struct net_pkt *pkt,
77+
struct net_udp_hdr *hdr)
78+
{
79+
return NULL;
80+
}
81+
7182
#endif /* CONFIG_NET_UDP */
7283

7384
/**

0 commit comments

Comments
 (0)