[virt-tools-list] [PATCH glib] Avoid unused variable in DHCP lease finalize method

Daniel P. Berrange berrange at redhat.com
Thu Jul 28 12:30:27 UTC 2016


If the network DHCP lease support is not detected, the build
will generate a warning / error:

libvirt-gobject-network-dhcp-lease.c: In function 'gvir_network_dhcp_lease_finalize':
libvirt-gobject-network-dhcp-lease.c:99:27: error: unused variable 'lease' [-Werror=unused-variable]
     GVirNetworkDHCPLease *lease = GVIR_NETWORK_DHCP_LEASE(object);
                           ^~~~~
cc1: all warnings being treated as errors

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---

Pushed as a broken build fix

 libvirt-gobject/libvirt-gobject-network-dhcp-lease.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c b/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c
index 7d1c979..200778d 100644
--- a/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c
+++ b/libvirt-gobject/libvirt-gobject-network-dhcp-lease.c
@@ -96,12 +96,10 @@ static void gvir_network_dhcp_lease_set_property(GObject *object,
 
 static void gvir_network_dhcp_lease_finalize(GObject *object)
 {
-    GVirNetworkDHCPLease *lease = GVIR_NETWORK_DHCP_LEASE(object);
 #ifdef HAVE_VIR_NETWORK_GET_DHCP_LEASES
+    GVirNetworkDHCPLease *lease = GVIR_NETWORK_DHCP_LEASE(object);
     GVirNetworkDHCPLeasePrivate *priv = lease->priv;
-#endif /* HAVE_VIR_NETWORK_GET_DHCP_LEASES */
 
-#ifdef HAVE_VIR_NETWORK_GET_DHCP_LEASES
     virNetworkDHCPLeaseFree(priv->handle);
 #endif /* HAVE_VIR_NETWORK_GET_DHCP_LEASES */
 
-- 
2.7.4




More information about the virt-tools-list mailing list