On Wed, Jun 26, 2013 at 03:01:48PM +0200, Peter Krempa wrote:
Simplification of the code without functional impact.
---
src/conf/domain_conf.c | 72 ++++++++++++++++++++++----------------------------
1 file changed, 32 insertions(+), 40 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index e41dfa2..6b6196c 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4230,52 +4230,50 @@ static virSecurityLabelDefPtr
virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
unsigned int flags)
{
- char *p;
+ char *str = NULL;
virSecurityLabelDefPtr def = NULL;
+ size_t labellen = VIR_SECURITY_LABEL_BUFLEN - 1;
/* Always parse model */
- p = virXPathStringLimit("string(./@model)",
- VIR_SECURITY_MODEL_BUFLEN-1, ctxt);
- def->model = p;
+ def->model = virXPathStringLimit("string(./@model)", labellen, ctxt);
labellen here does not match the original constant value.
I don't like this change - I think it is clearer code as it
was using the constant directly. The use of a variable
obscures the code leading to bugs like the one you have
introduced here.
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|