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

[libvirt] [PATCH] conf: eliminate redundat VIR_ALLOC of first element of hosts.



virNetworkDNSHostsDefParseXML was calling VIR_ALLOC(def->hosts) if
def->nhosts was 0. This is a waste of time, though, since
VIR_REALLOC_N is called a few lines further down, prior to any use of
def->hosts.
---
 src/conf/network_conf.c |    8 --------
 1 files changed, 0 insertions(+), 8 deletions(-)

diff --git a/src/conf/network_conf.c b/src/conf/network_conf.c
index e055094..109739f 100644
--- a/src/conf/network_conf.c
+++ b/src/conf/network_conf.c
@@ -495,14 +495,6 @@ virNetworkDNSHostsDefParseXML(virNetworkDNSDefPtr def,
     virSocketAddr inaddr;
     int ret = -1;
 
-    if (def->hosts == NULL) {
-        if (VIR_ALLOC(def->hosts) < 0) {
-            virReportOOMError();
-            goto error;
-        }
-        def->nhosts = 0;
-    }
-
     if (!(ip = virXMLPropString(node, "ip")) ||
         (virSocketParseAddr(ip, &inaddr, AF_UNSPEC) < 0)) {
         virNetworkReportError(VIR_ERR_XML_DETAIL,
-- 
1.7.3.4


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