1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-01-27 14:03:36 +03:00

parser: Move implementation of xmlCtxtGetLastError

This commit is contained in:
Nick Wellnhofer 2024-06-25 23:19:56 +02:00
parent 7c11da2d98
commit fa50be923b
2 changed files with 40 additions and 40 deletions

40
error.c
View File

@ -967,46 +967,6 @@ xmlResetLastError(void)
xmlResetError(&xmlLastError);
}
/**
* xmlCtxtGetLastError:
* @ctx: an XML parser context
*
* Get the last parsing error registered.
*
* Returns NULL if no error occurred or a pointer to the error
*/
const xmlError *
xmlCtxtGetLastError(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt == NULL)
return (NULL);
if (ctxt->lastError.code == XML_ERR_OK)
return (NULL);
return (&ctxt->lastError);
}
/**
* xmlCtxtResetLastError:
* @ctx: an XML parser context
*
* Cleanup the last global error registered. For parsing error
* this does not change the well-formedness result.
*/
void
xmlCtxtResetLastError(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt == NULL)
return;
ctxt->errNo = XML_ERR_OK;
if (ctxt->lastError.code == XML_ERR_OK)
return;
xmlResetError(&ctxt->lastError);
}
/**
* xmlCopyError:
* @from: a source error

View File

@ -121,6 +121,46 @@ xmlCtxtSetErrorHandler(xmlParserCtxtPtr ctxt, xmlStructuredErrorFunc handler,
ctxt->errorCtxt = data;
}
/**
* xmlCtxtGetLastError:
* @ctx: an XML parser context
*
* Get the last parsing error registered.
*
* Returns NULL if no error occurred or a pointer to the error
*/
const xmlError *
xmlCtxtGetLastError(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt == NULL)
return (NULL);
if (ctxt->lastError.code == XML_ERR_OK)
return (NULL);
return (&ctxt->lastError);
}
/**
* xmlCtxtResetLastError:
* @ctx: an XML parser context
*
* Cleanup the last global error registered. For parsing error
* this does not change the well-formedness result.
*/
void
xmlCtxtResetLastError(void *ctx)
{
xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) ctx;
if (ctxt == NULL)
return;
ctxt->errNo = XML_ERR_OK;
if (ctxt->lastError.code == XML_ERR_OK)
return;
xmlResetError(&ctxt->lastError);
}
/**
* xmlCtxtErrMemory:
* @ctxt: an XML parser context