mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
conf: use virXMLPropStringLimit where it makes sense
The XPath call for these cases is more expensive than accessing the XML dom node directly. Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
This commit is contained in:
parent
d5b025bb15
commit
422cf16079
@ -7227,8 +7227,8 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
char *p;
|
char *p;
|
||||||
virSecurityLabelDefPtr seclabel = NULL;
|
virSecurityLabelDefPtr seclabel = NULL;
|
||||||
|
|
||||||
p = virXPathStringLimit("string(./@model)",
|
p = virXMLPropStringLimit(ctxt->node, "model",
|
||||||
VIR_SECURITY_MODEL_BUFLEN - 1, ctxt);
|
VIR_SECURITY_MODEL_BUFLEN - 1);
|
||||||
|
|
||||||
if (!(seclabel = virSecurityLabelDefNew(p)))
|
if (!(seclabel = virSecurityLabelDefNew(p)))
|
||||||
goto error;
|
goto error;
|
||||||
@ -7237,8 +7237,8 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
/* set default value */
|
/* set default value */
|
||||||
seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
|
seclabel->type = VIR_DOMAIN_SECLABEL_DYNAMIC;
|
||||||
|
|
||||||
p = virXPathStringLimit("string(./@type)",
|
p = virXMLPropStringLimit(ctxt->node, "type",
|
||||||
VIR_SECURITY_LABEL_BUFLEN - 1, ctxt);
|
VIR_SECURITY_LABEL_BUFLEN - 1);
|
||||||
if (p) {
|
if (p) {
|
||||||
seclabel->type = virDomainSeclabelTypeFromString(p);
|
seclabel->type = virDomainSeclabelTypeFromString(p);
|
||||||
if (seclabel->type <= 0) {
|
if (seclabel->type <= 0) {
|
||||||
@ -7253,8 +7253,8 @@ virSecurityLabelDefParseXML(xmlXPathContextPtr ctxt,
|
|||||||
seclabel->relabel = false;
|
seclabel->relabel = false;
|
||||||
|
|
||||||
VIR_FREE(p);
|
VIR_FREE(p);
|
||||||
p = virXPathStringLimit("string(./@relabel)",
|
p = virXMLPropStringLimit(ctxt->node, "relabel",
|
||||||
VIR_SECURITY_LABEL_BUFLEN-1, ctxt);
|
VIR_SECURITY_LABEL_BUFLEN-1);
|
||||||
if (p) {
|
if (p) {
|
||||||
if (STREQ(p, "yes")) {
|
if (STREQ(p, "yes")) {
|
||||||
seclabel->relabel = true;
|
seclabel->relabel = true;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user