
On Mon, Apr 04, 2016 at 03:20:21PM +0200, Pavel Hrdina wrote:
Refactor the listen parser to use only one loop.
Signed-off-by: Pavel Hrdina <phrdina@redhat.com> --- src/conf/domain_conf.c | 117 +++++++++++++++++++++---------------------------- 1 file changed, 50 insertions(+), 67 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a0ef3d9..9d48d07 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c
+ /* listen attribute of <graphics> is also supported by these, + * but must match the 'address' attribute of the first listen + * that is type='address' (if present) */ + listenAddr = virXMLPropString(node, "listen"); + if (listenAddr && !listenAddr[0]) + VIR_FREE(listenAddr); + + if (STREQ_NULLABLE(address->address, listenAddr) < 0) {
This is dead code, since it expands to strcmp(a,b) == 0. Drop the comparison against zero and use STRNEQ_NULLABLE instead. Also, the check should only be done if address is non-NULL, for XMLs with no <listen> elements. ACK with that fixed. Jan