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:
parent
7c11da2d98
commit
fa50be923b
40
error.c
40
error.c
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user