summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2022-05-06 12:10:41 +0200
committerThomas Haller <thaller@redhat.com>2022-05-06 12:20:16 +0200
commit135a706b60a153a0281e7ef29c00ffb548ec0626 (patch)
tree93791c98a453309b9e9304238ce6acdcc71af7f8
parent0ea11bee7b974e193ffc34b5b1d7f0d5825b263a (diff)
downloadlibnl-135a706b60a153a0281e7ef29c00ffb548ec0626.tar.gz
utils: add _NL_AUTO_DEFINE_FCN_STRUCT() macro
-rw-r--r--include/netlink-private/nl-auto.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/netlink-private/nl-auto.h b/include/netlink-private/nl-auto.h
index 4434a5b8..4092782b 100644
--- a/include/netlink-private/nl-auto.h
+++ b/include/netlink-private/nl-auto.h
@@ -15,6 +15,14 @@ static inline void name(void *v) \
} \
struct _nl_dummy_for_tailing_semicolon
+#define _NL_AUTO_DEFINE_FCN_STRUCT(CastType, name, func) \
+static inline void name(CastType *v) \
+{ \
+ if (v) \
+ func(v); \
+} \
+struct _nl_dummy_for_tailing_semicolon
+
#define _NL_AUTO_DEFINE_FCN_TYPED0(CastType, name, func) \
static inline void name(CastType *v) \
{ \