1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-24 13:33:01 +03:00

globals: Remove unused globals from thread storage

Setting these deprecated globals hasn't had an effect for a long time.
Make them constants. This reduces the size of per-thread storage from
~700 to ~250 bytes.
This commit is contained in:
Nick Wellnhofer
2023-12-06 01:09:31 +01:00
parent be558647c1
commit c011e7605d
6 changed files with 78 additions and 68 deletions

View File

@@ -4844,10 +4844,12 @@ htmlParseDocument(htmlParserCtxtPtr ctxt) {
}
/*
* SAX: beginning of the document processing.
* Document locator is unused. Only for backward compatibility.
*/
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
ctxt->sax->setDocumentLocator(ctxt->userData, &xmlDefaultSAXLocator);
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) {
xmlSAXLocator copy = xmlDefaultSAXLocator;
ctxt->sax->setDocumentLocator(ctxt->userData, &copy);
}
xmlDetectEncoding(ctxt);
@@ -5435,9 +5437,10 @@ htmlParseTryOrFinish(htmlParserCtxtPtr ctxt, int terminate) {
SKIP_BLANKS;
avail = in->end - in->cur;
}
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator))
ctxt->sax->setDocumentLocator(ctxt->userData,
&xmlDefaultSAXLocator);
if ((ctxt->sax) && (ctxt->sax->setDocumentLocator)) {
xmlSAXLocator copy = xmlDefaultSAXLocator;
ctxt->sax->setDocumentLocator(ctxt->userData, &copy);
}
if ((ctxt->sax) && (ctxt->sax->startDocument) &&
(!ctxt->disableSAX))
ctxt->sax->startDocument(ctxt->userData);