On 07/11/2014 03:32 AM, Michal Privoznik wrote:
Instead of allocating the virSecurityLabelDef structure ourselves,
we
can utilize virSecurityLabelDefNew which even sets the default values
for us.
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
src/conf/domain_conf.c | 103 ++++++++++++++++++++++++-------------------------
1 file changed, 50 insertions(+), 53 deletions(-)
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 7b90903..de60cd2 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -4553,91 +4553,87 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
unsigned int flags)
{
char *p;
- virSecurityLabelDefPtr def = NULL;
+ virSecurityLabelDefPtr seclabel = NULL;
Looks like you did a search-and-replace s/def/seclabel/...
- if (VIR_ALLOC(def) < 0)
+ p = virXPathStringLimit("string(./@model)",
+ VIR_SECURITY_MODEL_BUFLEN - 1, ctxt);
+
+ if (!(seclabel = virSecurityLabelDefNew(p)))
goto error;
+ /* set seclabelault value */
...but didn't pay attention to what got replaced :)
- if (p != NULL) {
+ if (p) {
if (STREQ(p, "yes")) {
- def->relabel = true;
+ seclabel->relabel = true;
I'm guessing that this assignment is now redundant with the fact that it
already defaults to this value; but I'm okay leaving it to make the code
obvious.
ACK with the typo fix.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org