[libxml2] Memory error within SAX2 reuse common framework
- From: Daniel Veillard <veillard src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Memory error within SAX2 reuse common framework
- Date: Wed, 18 Jul 2012 10:07:11 +0000 (UTC)
commit 740cb1a450e56326b249ded093c152f1b93ee15f
Author: Daniel Veillard <veillard redhat com>
Date: Wed Jul 18 16:05:37 2012 +0800
Memory error within SAX2 reuse common framework
There is no reason for that class of errors to not use
the same handling allowing strctured error processing.
SAX2.c | 21 +++++++++++++++++++--
1 files changed, 19 insertions(+), 2 deletions(-)
---
diff --git a/SAX2.c b/SAX2.c
index 126a79f..62ddcb2 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -57,12 +57,29 @@
*/
static void
xmlSAX2ErrMemory(xmlParserCtxtPtr ctxt, const char *msg) {
+ xmlStructuredErrorFunc schannel = NULL;
+ const char *str1 = "out of memory\n";
+
if (ctxt != NULL) {
- if ((ctxt->sax != NULL) && (ctxt->sax->error != NULL))
- ctxt->sax->error(ctxt->userData, "%s: out of memory\n", msg);
+ ctxt->errNo = XML_ERR_NO_MEMORY;
+ if ((ctxt->sax != NULL) && (ctxt->sax->initialized == XML_SAX2_MAGIC))
+ schannel = ctxt->sax->serror;
+ __xmlRaiseError(schannel,
+ ctxt->vctxt.error, ctxt->vctxt.userData,
+ ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
+ XML_ERR_ERROR, NULL, 0, (const char *) str1,
+ NULL, NULL, 0, 0,
+ msg, (const char *) str1, NULL);
ctxt->errNo = XML_ERR_NO_MEMORY;
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
+ } else {
+ __xmlRaiseError(schannel,
+ NULL, NULL,
+ ctxt, NULL, XML_FROM_PARSER, XML_ERR_NO_MEMORY,
+ XML_ERR_ERROR, NULL, 0, (const char *) str1,
+ NULL, NULL, 0, 0,
+ msg, (const char *) str1, NULL);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]