1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-07-29 11:41:22 +03:00

Cleanups, 1 bug fix:

- HTMLparser.c: fixed htmlStartCloseIndexinitialized init
- entities.h: exported xmlInitializePredefinedEntities
- parser.[ch] : added xmlInitParser()
- parserInternals.h : had to export htmlInitAutoClose()
Daniel
This commit is contained in:
Daniel Veillard
2000-10-01 18:23:35 +00:00
parent f09e7e35de
commit bc765307ff
9 changed files with 56 additions and 4 deletions

View File

@ -1,3 +1,10 @@
Sun Oct 1 20:19:39 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* HTMLparser.c: fixed htmlStartCloseIndexinitialized init
* entities.h: exported xmlInitializePredefinedEntities
* parser.[ch] : added xmlInitParser()
* parserInternals.h : had to export htmlInitAutoClose()
Sun Oct 1 16:28:22 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org> Sun Oct 1 16:28:22 CEST 2000 Daniel Veillard <Daniel.Veillard@w3.org>
* xpath.[ch] : fixed some serious XPath Predicate evaluation * xpath.[ch] : fixed some serious XPath Predicate evaluation

View File

@ -579,7 +579,8 @@ static int htmlStartCloseIndexinitialized = 0;
* htmlInitAutoClose: * htmlInitAutoClose:
* *
* Initialize the htmlStartCloseIndex for fast lookup of closing tags names. * Initialize the htmlStartCloseIndex for fast lookup of closing tags names.
* * This is not reentrant. Call xmlInitParser() once before processing in
* case of use in multithreaded programs.
*/ */
void void
htmlInitAutoClose(void) { htmlInitAutoClose(void) {
@ -594,6 +595,7 @@ htmlInitAutoClose(void) {
while (htmlStartClose[i] != NULL) i++; while (htmlStartClose[i] != NULL) i++;
i++; i++;
} }
htmlStartCloseIndexinitialized = 1;
} }
/** /**

View File

@ -86,6 +86,7 @@ struct _xmlEntitiesTable {
* External functions : * External functions :
*/ */
void xmlInitializePredefinedEntities (void);
xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc, xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
const xmlChar *name, const xmlChar *name,
int type, int type,

View File

@ -86,6 +86,7 @@ struct _xmlEntitiesTable {
* External functions : * External functions :
*/ */
void xmlInitializePredefinedEntities (void);
xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc, xmlEntityPtr xmlAddDocEntity (xmlDocPtr doc,
const xmlChar *name, const xmlChar *name,
int type, int type,

View File

@ -310,8 +310,9 @@ extern int xmlGetWarningsDefaultValue;
/** /**
* Cleanup * Init/Cleanup
*/ */
void xmlInitParser (void);
void xmlCleanupParser (void); void xmlCleanupParser (void);
/** /**

View File

@ -287,6 +287,13 @@ int xmlCopyChar (int len,
int val); int val);
void xmlNextChar (xmlParserCtxtPtr ctxt); void xmlNextChar (xmlParserCtxtPtr ctxt);
void xmlParserInputShrink (xmlParserInputPtr in); void xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff
*/
void htmlInitAutoClose (void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -6909,7 +6909,7 @@ xmlParseDocument(xmlParserCtxtPtr ctxt) {
xmlChar start[4]; xmlChar start[4];
xmlCharEncoding enc; xmlCharEncoding enc;
xmlDefaultSAXHandlerInit(); xmlInitParser();
GROW; GROW;
@ -9477,6 +9477,30 @@ xmlParseDoc(xmlChar *cur) {
* * * *
************************************************************************/ ************************************************************************/
static int xmlParserInitialized = 0;
/**
* xmlInitParser:
*
* Initialization function for the XML parser.
* This is not reentrant. Call once before processing in case of
* use in multithreaded programs.
*/
void
xmlInitParser(void) {
if (xmlParserInitialized) return;
xmlInitCharEncodingHandlers();
xmlInitializePredefinedEntities();
xmlDefaultSAXHandlerInit();
#ifdef LIBXML_HTML_ENABLED
htmlInitAutoClose();
htmlDefaultSAXHandlerInit();
#endif
xmlParserInitialized = 1;
}
/** /**
* xmlCleanupParser: * xmlCleanupParser:
* *
@ -9488,6 +9512,7 @@ xmlParseDoc(xmlChar *cur) {
void void
xmlCleanupParser(void) { xmlCleanupParser(void) {
xmlParserInitialized = 0;
xmlCleanupCharEncodingHandlers(); xmlCleanupCharEncodingHandlers();
xmlCleanupPredefinedEntities(); xmlCleanupPredefinedEntities();
} }

View File

@ -310,8 +310,9 @@ extern int xmlGetWarningsDefaultValue;
/** /**
* Cleanup * Init/Cleanup
*/ */
void xmlInitParser (void);
void xmlCleanupParser (void); void xmlCleanupParser (void);
/** /**

View File

@ -287,6 +287,13 @@ int xmlCopyChar (int len,
int val); int val);
void xmlNextChar (xmlParserCtxtPtr ctxt); void xmlNextChar (xmlParserCtxtPtr ctxt);
void xmlParserInputShrink (xmlParserInputPtr in); void xmlParserInputShrink (xmlParserInputPtr in);
#ifdef LIBXML_HTML_ENABLED
/*
* Actually comes from the HTML parser but launched from the init stuff
*/
void htmlInitAutoClose (void);
#endif
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif