[libvirt] [PATCH] conf: eliminate redundant VIR_ALLOC of 1st element of network DNS hosts.
virNetworkDNSHostsDefParseXML was calling VIR_ALLOC(def-hosts) if def-hosts was NULL. 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. (initializing def-nhosts to 0 is also redundant, because the newly allocated memory will always be cleared to all 0's anyway). --- 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 743ae92..0333141 100644 --- a/src/conf/network_conf.c +++ b/src/conf/network_conf.c @@ -510,14 +510,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)) || (virSocketAddrParse(inaddr, ip, AF_UNSPEC) 0)) { virNetworkReportError(VIR_ERR_XML_DETAIL, -- 1.7.7.6 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: eliminate redundant VIR_ALLOC of 1st element of network DNS hosts.
On 09.03.2012 10:03, Laine Stump wrote: virNetworkDNSHostsDefParseXML was calling VIR_ALLOC(def-hosts) if def-hosts was NULL. 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. (initializing def-nhosts to 0 is also redundant, because the newly allocated memory will always be cleared to all 0's anyway). --- src/conf/network_conf.c |8 1 files changed, 0 insertions(+), 8 deletions(-) ACK Michal -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH] conf: eliminate redundant VIR_ALLOC of 1st element of network DNS hosts.
On 03/09/2012 04:23 AM, Michal Privoznik wrote: On 09.03.2012 10:03, Laine Stump wrote: virNetworkDNSHostsDefParseXML was calling VIR_ALLOC(def-hosts) if def-hosts was NULL. 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. (initializing def-nhosts to 0 is also redundant, because the newly allocated memory will always be cleared to all 0's anyway). --- src/conf/network_conf.c |8 1 files changed, 0 insertions(+), 8 deletions(-) ACK Pushed. Thanks! -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list