core: cleanup implementation of nm_auto* macros to use nm_auto()

Don't use __attribute__((cleanup(func))) directly.
This commit is contained in:
Thomas Haller 2017-10-11 08:40:14 +02:00
parent 92e8ec5e1e
commit 1a8f123328
3 changed files with 3 additions and 4 deletions

View file

@ -865,12 +865,12 @@ _nl_addattr_l (struct nlmsghdr *n,
return TRUE;
}
#define nm_auto_nlmsg __attribute__((cleanup(_nm_auto_nl_msg_cleanup)))
static void
_nm_auto_nl_msg_cleanup (void *ptr)
{
nlmsg_free (*((struct nl_msg **) ptr));
}
#define nm_auto_nlmsg nm_auto(_nm_auto_nl_msg_cleanup)
static const char *
_nl_nlmsghdr_to_str (const struct nlmsghdr *hdr, char *buf, gsize len)

View file

@ -60,8 +60,7 @@ _nm_auto_pop_netns (NMPNetns **p)
errno = errsv;
}
}
#define nm_auto_pop_netns __attribute__((cleanup(_nm_auto_pop_netns)))
#define nm_auto_pop_netns nm_auto(_nm_auto_pop_netns)
gboolean nmp_netns_bind_to_path (NMPNetns *self, const char *filename, int *out_fd);
gboolean nmp_netns_bind_to_path_destroy (NMPNetns *self, const char *filename);

View file

@ -489,12 +489,12 @@ gboolean nmp_object_is_visible (const NMPObject *obj);
void _nmp_object_fixup_link_udev_fields (NMPObject **obj_new, NMPObject *obj_orig, gboolean use_udev);
#define nm_auto_nmpobj __attribute__((cleanup(_nm_auto_nmpobj_cleanup)))
static inline void
_nm_auto_nmpobj_cleanup (gpointer p)
{
nmp_object_unref (*((const NMPObject **) p));
}
#define nm_auto_nmpobj nm_auto(_nm_auto_nmpobj_cleanup)
typedef struct _NMPCache NMPCache;