[systemd-devel] [PATCH] sd-dhcp-server: remove unused cleanup function
Lennart Poettering
lennart at poettering.net
Fri Jun 20 10:38:21 PDT 2014
On Fri, 13.06.14 21:04, Thomas H.P. Andersen (phomes at gmail.com) wrote:
> From: Thomas Hindoe Paaboel Andersen <phomes at gmail.com>
>
> Removes _cleanup_dhcp_lease_free_. While the automatic cleanup
> functions are great to have this one is never used and causes
> a warning in clang.
Applied! Thanks!
> -DEFINE_TRIVIAL_CLEANUP_FUNC(DHCPLease*, dhcp_lease_free);
> -#define _cleanup_dhcp_lease_free_ _cleanup_(dhcp_lease_freep)
> -
BTW, taking the opportunity for a public service announcement:
When I added the _cleanup_() macros I never intended that every single
user of it would #define its own _cleanup_foobar_() macro. I just did
that for the most common ones, since I didn't want to make visible the
fact that internally this requires the indirection via the -p function
that DEFINE_TRIVIAL_CLEANUP_FUNC() defines.
Not that it really matters, but for cleanup handlers that are never
exported in a header file I would probably avoid defining a new macro,
and just use DEFINE_TRIVIAL_CLEANUP_FUNC where necesary, and then
directly declare my variables with naked _cleanup_()
_cleanup_(dhcp_lease_freep) DHCPLease *lease;
I mean, if this is not exposed, then there's no need to hide the
indirection via the -p function, if you follow what i mean.
That all said, this really doesn't matter, so if you feel like defining
macros each time go ahead, i won't stop you... ;-)
Lennart
--
Lennart Poettering, Red Hat
More information about the systemd-devel
mailing list