Re: [systemd-devel] [PATCH] sd-dhcp-server: remove unused cleanup function

2014-06-20 Thread Lennart Poettering
On Fri, 13.06.14 21:04, Thomas H.P. Andersen (pho...@gmail.com) wrote:

 From: Thomas Hindoe Paaboel Andersen pho...@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
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] [PATCH] sd-dhcp-server: remove unused cleanup function

2014-06-13 Thread Thomas H.P. Andersen
From: Thomas Hindoe Paaboel Andersen pho...@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.
---
 src/libsystemd-network/sd-dhcp-server.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/libsystemd-network/sd-dhcp-server.c 
b/src/libsystemd-network/sd-dhcp-server.c
index 4ce1054..17c19cc 100644
--- a/src/libsystemd-network/sd-dhcp-server.c
+++ b/src/libsystemd-network/sd-dhcp-server.c
@@ -105,9 +105,6 @@ static void dhcp_lease_free(DHCPLease *lease) {
 free(lease);
 }
 
-DEFINE_TRIVIAL_CLEANUP_FUNC(DHCPLease*, dhcp_lease_free);
-#define _cleanup_dhcp_lease_free_ _cleanup_(dhcp_lease_freep)
-
 sd_dhcp_server *sd_dhcp_server_unref(sd_dhcp_server *server) {
 if (server  REFCNT_DEC(server-n_ref) = 0) {
 DHCPLease *lease;
-- 
1.9.3

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel