mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virXMLParseHelper: Store XML parsing flags in a variable
The virXMLParseHelper() can work in two modes: either it parses a file or a string. Either way, the same set of flags is specified in call of corresponding function. Save flags in a local variable instead. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
7a5f232be2
commit
1beb69df87
@ -1136,6 +1136,7 @@ virXMLParseHelper(int domcode,
|
||||
g_autoptr(xmlDoc) xml = NULL;
|
||||
xmlNodePtr rootnode;
|
||||
const char *docname;
|
||||
const int parseFlags = XML_PARSE_NONET | XML_PARSE_NOWARNING;
|
||||
|
||||
if (filename)
|
||||
docname = filename;
|
||||
@ -1154,13 +1155,9 @@ virXMLParseHelper(int domcode,
|
||||
pctxt->sax->error = catchXMLError;
|
||||
|
||||
if (filename) {
|
||||
xml = xmlCtxtReadFile(pctxt, filename, NULL,
|
||||
XML_PARSE_NONET |
|
||||
XML_PARSE_NOWARNING);
|
||||
xml = xmlCtxtReadFile(pctxt, filename, NULL, parseFlags);
|
||||
} else {
|
||||
xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL,
|
||||
XML_PARSE_NONET |
|
||||
XML_PARSE_NOWARNING);
|
||||
xml = xmlCtxtReadDoc(pctxt, BAD_CAST xmlStr, url, NULL, parseFlags);
|
||||
}
|
||||
|
||||
if (!xml) {
|
||||
|
Loading…
Reference in New Issue
Block a user