[libvirt] [PATCH 2/3] virSecurityLabelDefParseXML: Rework
Eric Blake
eblake at redhat.com
Fri Jul 11 16:54:26 UTC 2014
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 at 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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140711/6ed3226a/attachment-0001.sig>
More information about the libvir-list
mailing list