]> git.ipfire.org Git - thirdparty/libvirt.git/commit
conf: refactor virDomainBlkioDeviceParseXML to reduce calls to xmlNodeGetContent
authorLaine Stump <laine@redhat.com>
Fri, 19 Jun 2020 01:52:38 +0000 (21:52 -0400)
committerLaine Stump <laine@redhat.com>
Wed, 5 Aug 2020 04:00:18 +0000 (00:00 -0400)
commitb595f44525412bb7e5b02a57faa442b02cc85f57
tree193e4fd7cc47037c329c888d4c4d68fb49abe867
parented8d1385f775e8dc22887f0a1bdc425ab8e1b223
conf: refactor virDomainBlkioDeviceParseXML to reduce calls to xmlNodeGetContent

virDomainBlkioDeviceParseXML() calls xmlNodeGetContent() multiple
times in a loop, but can easily be refactored to call it once for all
element nodes, and then use the result of that one call in each of the
(mutually exclusive) blocks that previously each had their own call to
xmlNodeGetContent.

This is being done in order to reduce the number of changes needed in
an upcoming patch that will eliminate the lack of checking for NULL on
return from xmlNodeGetContent().

As part of the simplification, the while() loop has been changed into
a for() so that we can use "continue" without bypassing the
"node = node->next".

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/conf/domain_conf.c