mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 04:25:18 +00:00
util/virxml: use xmlCtxtGetLastError when applicable
xmlParserCtxt->lastError was deprecated in libxml2 v2.13.0-103-g1228b4e0 xmlCtxtGetLastError(xmlParserCtxt) should be used instead Signed-off-by: Jakub Palacky <jpalacky@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
317139a316
commit
09ebe53349
@ -1029,14 +1029,15 @@ catchXMLError(void *ctx, const char *msg G_GNUC_UNUSED, ...)
|
|||||||
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
g_auto(virBuffer) buf = VIR_BUFFER_INITIALIZER;
|
||||||
g_autofree char *contextstr = NULL;
|
g_autofree char *contextstr = NULL;
|
||||||
g_autofree char *pointerstr = NULL;
|
g_autofree char *pointerstr = NULL;
|
||||||
|
const xmlError *lastError = xmlCtxtGetLastError(ctxt);
|
||||||
|
|
||||||
/* conditions for error printing */
|
/* conditions for error printing */
|
||||||
if (!ctxt ||
|
if (!ctxt ||
|
||||||
(virGetLastErrorCode()) ||
|
(virGetLastErrorCode()) ||
|
||||||
ctxt->input == NULL ||
|
ctxt->input == NULL ||
|
||||||
ctxt->lastError.level != XML_ERR_FATAL ||
|
lastError == NULL ||
|
||||||
ctxt->lastError.message == NULL)
|
lastError->level != XML_ERR_FATAL ||
|
||||||
|
lastError->message == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ctxt->_private)
|
if (ctxt->_private)
|
||||||
@ -1078,19 +1079,19 @@ catchXMLError(void *ctx, const char *msg G_GNUC_UNUSED, ...)
|
|||||||
|
|
||||||
pointerstr = virBufferContentAndReset(&buf);
|
pointerstr = virBufferContentAndReset(&buf);
|
||||||
|
|
||||||
if (ctxt->lastError.file) {
|
if (lastError->file) {
|
||||||
virGenericReportError(domcode, VIR_ERR_XML_DETAIL,
|
virGenericReportError(domcode, VIR_ERR_XML_DETAIL,
|
||||||
_("%1$s:%2$d: %3$s%4$s\n%5$s"),
|
_("%1$s:%2$d: %3$s%4$s\n%5$s"),
|
||||||
ctxt->lastError.file,
|
lastError->file,
|
||||||
ctxt->lastError.line,
|
lastError->line,
|
||||||
ctxt->lastError.message,
|
lastError->message,
|
||||||
contextstr,
|
contextstr,
|
||||||
pointerstr);
|
pointerstr);
|
||||||
} else {
|
} else {
|
||||||
virGenericReportError(domcode, VIR_ERR_XML_DETAIL,
|
virGenericReportError(domcode, VIR_ERR_XML_DETAIL,
|
||||||
_("at line %1$d: %2$s%3$s\n%4$s"),
|
_("at line %1$d: %2$s%3$s\n%4$s"),
|
||||||
ctxt->lastError.line,
|
lastError->line,
|
||||||
ctxt->lastError.message,
|
lastError->message,
|
||||||
contextstr,
|
contextstr,
|
||||||
pointerstr);
|
pointerstr);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user