[libxml2] Remove htmlDefaultSAXHandler from non-SAX1 build
- From: Nick Wellnhofer <nwellnhof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libxml2] Remove htmlDefaultSAXHandler from non-SAX1 build
- Date: Mon, 22 Aug 2022 13:44:03 +0000 (UTC)
commit 4b184240beaaccab7e639205ed52536cd02e78af
Author: Nick Wellnhofer <wellnhofer aevum de>
Date: Mon Aug 22 14:11:15 2022 +0200
Remove htmlDefaultSAXHandler from non-SAX1 build
This matches long-standing behavior of the XML counterpart.
HTMLparser.c | 2 ++
SAX2.c | 2 ++
globals.c | 4 ++--
3 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/HTMLparser.c b/HTMLparser.c
index 4d2a343e..b270ce46 100644
--- a/HTMLparser.c
+++ b/HTMLparser.c
@@ -6338,7 +6338,9 @@ htmlCreatePushParserCtxt(htmlSAXHandlerPtr sax, void *user_data,
if(enc==XML_CHAR_ENCODING_UTF8 || buf->encoder)
ctxt->charset=XML_CHAR_ENCODING_UTF8;
if (sax != NULL) {
+#ifdef LIBXML_SAX1_ENABLED
if (ctxt->sax != (xmlSAXHandlerPtr) &htmlDefaultSAXHandler)
+#endif
xmlFree(ctxt->sax);
ctxt->sax = (htmlSAXHandlerPtr) xmlMalloc(sizeof(htmlSAXHandler));
if (ctxt->sax == NULL) {
diff --git a/SAX2.c b/SAX2.c
index ec89046b..36f74f24 100644
--- a/SAX2.c
+++ b/SAX2.c
@@ -2998,7 +2998,9 @@ xmlSAX2InitHtmlDefaultSAXHandler(xmlSAXHandler *hdlr)
void
htmlDefaultSAXHandlerInit(void)
{
+#ifdef LIBXML_SAX1_ENABLED
xmlSAX2InitHtmlDefaultSAXHandler((xmlSAXHandlerPtr) &htmlDefaultSAXHandler);
+#endif
}
#endif /* LIBXML_HTML_ENABLED */
diff --git a/globals.c b/globals.c
index a15ac305..5e42f193 100644
--- a/globals.c
+++ b/globals.c
@@ -405,7 +405,7 @@ xmlSAXLocator xmlDefaultSAXLocator = {
xmlSAX2GetColumnNumber
};
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
/**
* htmlDefaultSAXHandler:
*
@@ -667,7 +667,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
return(old);
}
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
#undef htmlDefaultSAXHandler
xmlSAXHandlerV1 *
__htmlDefaultSAXHandler(void) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]