[libvirt] [PATCH 04/12] Remove useless condition in networkRadvdConfContents

Ján Tomko jtomko at redhat.com
Wed Jul 2 10:10:57 UTC 2014


If v6present is false, this code is not reachable.
Also, there is no need to check for errors twice.
---
 src/network/bridge_driver.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/src/network/bridge_driver.c b/src/network/bridge_driver.c
index 8624f1e..149a8fd 100644
--- a/src/network/bridge_driver.c
+++ b/src/network/bridge_driver.c
@@ -1535,20 +1535,15 @@ networkRadvdConfContents(virNetworkObjPtr network, char **configstr)
         VIR_FREE(netaddr);
     }
 
-    /* only create the string if we found at least one IPv6 address */
-    if (v6present) {
-        virBufferAddLit(&configbuf, "};\n");
+    virBufferAddLit(&configbuf, "};\n");
 
-        if (virBufferError(&configbuf)) {
-            virReportOOMError();
-            goto cleanup;
-        }
-        if (!(*configstr = virBufferContentAndReset(&configbuf))) {
-            virReportOOMError();
-            goto cleanup;
-        }
+    if (virBufferError(&configbuf)) {
+        virReportOOMError();
+        goto cleanup;
     }
 
+    *configstr = virBufferContentAndReset(&configbuf);
+
     ret = 0;
  cleanup:
     virBufferFreeAndReset(&configbuf);
-- 
1.8.5.5




More information about the libvir-list mailing list