mirror of
https://gitlab.gnome.org/GNOME/libxml2.git
synced 2025-07-29 11:41:22 +03:00
converting the tree module too created a simpler internal error reporting
* tree.c: converting the tree module too * error.c include/libxml/xmlerror.h: created a simpler internal error reporting function. Daniel
This commit is contained in:
30
error.c
30
error.c
@ -517,6 +517,36 @@ __xmlRaiseError(xmlGenericErrorFunc channel, void *data, void *ctx,
|
||||
channel(data, "%s", str);
|
||||
}
|
||||
|
||||
/**
|
||||
* __xmlSimpleError:
|
||||
* @domain: where the error comes from
|
||||
* @code: the error code
|
||||
* @node: the context node
|
||||
* @extra: extra informations
|
||||
*
|
||||
* Handle an out of memory condition
|
||||
*/
|
||||
void
|
||||
__xmlSimpleError(int domain, int code, xmlNodePtr node,
|
||||
const char *msg, const char *extra)
|
||||
{
|
||||
|
||||
if (code == XML_ERR_NO_MEMORY) {
|
||||
if (extra)
|
||||
__xmlRaiseError(NULL, NULL, NULL, node, domain,
|
||||
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, extra,
|
||||
NULL, NULL, 0, 0,
|
||||
"Memory allocation failed : %s\n", extra);
|
||||
else
|
||||
__xmlRaiseError(NULL, NULL, NULL, node, domain,
|
||||
XML_ERR_NO_MEMORY, XML_ERR_FATAL, NULL, 0, NULL,
|
||||
NULL, NULL, 0, 0, "Memory allocation failed\n");
|
||||
} else {
|
||||
__xmlRaiseError(NULL, NULL, NULL, node, domain,
|
||||
code, XML_ERR_ERROR, NULL, 0, extra,
|
||||
NULL, NULL, 0, 0, msg, extra);
|
||||
}
|
||||
}
|
||||
/**
|
||||
* xmlParserError:
|
||||
* @ctx: an XML parser context
|
||||
|
Reference in New Issue
Block a user