Skip to content

Commit 4b9daa6

Browse files
KanjiMonsterthom311
authored andcommitted
add _nl_auto_nl_object helper
Add a helper for automatically cleaning up a nl_object reference. Signed-off-by: Jonas Gorski <[email protected]>
1 parent 379a140 commit 4b9daa6

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

include/nl-aux-core/nl-core.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ void nl_cache_mngr_free(struct nl_cache_mngr *mngr);
5050
_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_cache_mngr *, _nl_auto_nl_cache_mngr_fcn,
5151
nl_cache_mngr_free);
5252

53+
struct nl_object;
54+
void nl_object_put(struct nl_object *);
55+
#define _nl_auto_nl_object _nl_auto(_nl_auto_nl_object_fcn)
56+
_NL_AUTO_DEFINE_FCN_TYPED0(struct nl_object *, _nl_auto_nl_object_fcn,
57+
nl_object_put);
58+
5359
struct nl_addr *nl_addr_build(int, const void *, size_t);
5460

5561
static inline struct nl_addr *_nl_addr_build(int family, const void *buf)

0 commit comments

Comments
 (0)