[PATCH glib] Avoid unused variable in DHCP lease finalize method

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

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

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]