summaryrefslogtreecommitdiff
path: root/chromium/third_party/libxml/src/globals.c
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/libxml/src/globals.c')
-rw-r--r--chromium/third_party/libxml/src/globals.c165
1 files changed, 80 insertions, 85 deletions
diff --git a/chromium/third_party/libxml/src/globals.c b/chromium/third_party/libxml/src/globals.c
index 4aec81232be..7e5c1aa9ef3 100644
--- a/chromium/third_party/libxml/src/globals.c
+++ b/chromium/third_party/libxml/src/globals.c
@@ -21,6 +21,10 @@
#include <libxml/xmlmemory.h>
#include <libxml/threads.h>
+#include "private/error.h"
+#include "private/threads.h"
+#include "private/tree.h"
+
/* #define DEBUG_GLOBALS */
/*
@@ -40,6 +44,9 @@ static xmlMutexPtr xmlThrDefMutex = NULL;
/**
* xmlInitGlobals:
*
+ * DEPRECATED: This function will be made private. Call xmlInitParser to
+ * initialize the library.
+ *
* Additional initialisation for multi-threading
*/
void xmlInitGlobals(void)
@@ -134,7 +141,6 @@ xmlStrdupFunc xmlMemStrdup = xmlPosixStrdup;
#include <libxml/globals.h>
#include <libxml/SAX.h>
-#undef docbDefaultSAXHandler
#undef htmlDefaultSAXHandler
#undef oldXMLWDcompatibility
#undef xmlBufferAllocScheme
@@ -173,6 +179,8 @@ const char *xmlParserVersion = LIBXML_VERSION_STRING LIBXML_VERSION_EXTRA;
/**
* xmlBufferAllocScheme:
*
+ * DEPRECATED: Don't use.
+ *
* Global setting, default allocation policy for buffers, default is
* XML_BUFFER_ALLOC_EXACT
*/
@@ -181,6 +189,8 @@ static xmlBufferAllocationScheme xmlBufferAllocSchemeThrDef = XML_BUFFER_ALLOC_E
/**
* xmlDefaultBufferSize:
*
+ * DEPRECATED: Don't use.
+ *
* Global setting, default buffer size. Default value is BASE_BUFFER_SIZE
*/
int xmlDefaultBufferSize = BASE_BUFFER_SIZE;
@@ -199,6 +209,8 @@ int oldXMLWDcompatibility = 0; /* DEPRECATED */
/**
* xmlParserDebugEntities:
*
+ * DEPRECATED: Don't use
+ *
* Global setting, asking the parser to print out debugging information.
* while handling entities.
* Disabled by default
@@ -208,6 +220,8 @@ static int xmlParserDebugEntitiesThrDef = 0;
/**
* xmlDoValidityCheckingDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_DTDVALID.
+ *
* Global setting, indicate that the parser should work in validating mode.
* Disabled by default.
*/
@@ -216,7 +230,9 @@ static int xmlDoValidityCheckingDefaultValueThrDef = 0;
/**
* xmlGetWarningsDefaultValue:
*
- * Global setting, indicate that the parser should provide warnings.
+ * DEPRECATED: Don't use
+ *
+ * Global setting, indicate that the DTD validation should provide warnings.
* Activated by default.
*/
int xmlGetWarningsDefaultValue = 1;
@@ -224,6 +240,8 @@ static int xmlGetWarningsDefaultValueThrDef = 1;
/**
* xmlLoadExtDtdDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_DTDLOAD.
+ *
* Global setting, indicate that the parser should load DTD while not
* validating.
* Disabled by default.
@@ -233,6 +251,8 @@ static int xmlLoadExtDtdDefaultValueThrDef = 0;
/**
* xmlPedanticParserDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_PEDANTIC.
+ *
* Global setting, indicate that the parser be pedantic
* Disabled by default.
*/
@@ -241,6 +261,8 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
/**
* xmlLineNumbersDefaultValue:
*
+ * DEPRECATED: The modern options API always enables line numbers.
+ *
* Global setting, indicate that the parser should store the line number
* in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of
@@ -251,6 +273,8 @@ static int xmlLineNumbersDefaultValueThrDef = 0;
/**
* xmlKeepBlanksDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOBLANKS.
+ *
* Global setting, indicate that the parser should keep all blanks
* nodes found in the content
* Activated by default, this is actually needed to have the parser
@@ -262,6 +286,8 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
/**
* xmlSubstituteEntitiesDefaultValue:
*
+ * DEPRECATED: Use the modern options API with XML_PARSE_NOENT.
+ *
* Global setting, indicate that the parser should not generate entity
* references but replace them with the actual content of the entity
* Disabled by default, this should be activated when using XPath since
@@ -271,26 +297,38 @@ static int xmlKeepBlanksDefaultValueThrDef = 1;
int xmlSubstituteEntitiesDefaultValue = 0;
static int xmlSubstituteEntitiesDefaultValueThrDef = 0;
+/**
+ * xmlRegisterNodeDefaultValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlRegisterNodeFunc xmlRegisterNodeDefaultValue = NULL;
static xmlRegisterNodeFunc xmlRegisterNodeDefaultValueThrDef = NULL;
+
+/**
+ * xmlDeregisterNodeDefaultValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValue = NULL;
static xmlDeregisterNodeFunc xmlDeregisterNodeDefaultValueThrDef = NULL;
+/**
+ * xmlParserInputBufferCreateFilenameValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValue = NULL;
static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilenameValueThrDef = NULL;
+/**
+ * xmlOutputBufferCreateFilenameValue:
+ *
+ * DEPRECATED: Don't use
+ */
xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValue = NULL;
static xmlOutputBufferCreateFilenameFunc xmlOutputBufferCreateFilenameValueThrDef = NULL;
-/*
- * Error handling
- */
-
-/* xmlGenericErrorFunc xmlGenericError = xmlGenericErrorDefaultFunc; */
-/* Must initialize xmlGenericError in xmlInitParser */
-void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED,
- const char *msg,
- ...);
/**
* xmlGenericError:
*
@@ -356,6 +394,9 @@ static int xmlSaveNoEmptyTagsThrDef = 0;
/**
* xmlDefaultSAXHandler:
*
+ * DEPRECATED: This handler is unused and will be removed from future
+ * versions.
+ *
* Default SAX version1 handler for XML, builds the DOM tree
*/
xmlSAXHandlerV1 xmlDefaultSAXHandler = {
@@ -393,6 +434,8 @@ xmlSAXHandlerV1 xmlDefaultSAXHandler = {
/**
* xmlDefaultSAXLocator:
*
+ * DEPRECATED: Don't use
+ *
* The default SAX Locator
* { getPublicId, getSystemId, getLineNumber, getColumnNumber}
*/
@@ -403,10 +446,13 @@ xmlSAXLocator xmlDefaultSAXLocator = {
xmlSAX2GetColumnNumber
};
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
/**
* htmlDefaultSAXHandler:
*
+ * DEPRECATED: This handler is unused and will be removed from future
+ * versions.
+ *
* Default old SAX v1 handler for HTML, builds the DOM tree
*/
xmlSAXHandlerV1 htmlDefaultSAXHandler = {
@@ -441,44 +487,6 @@ xmlSAXHandlerV1 htmlDefaultSAXHandler = {
};
#endif /* LIBXML_HTML_ENABLED */
-#ifdef LIBXML_DOCB_ENABLED
-/**
- * docbDefaultSAXHandler:
- *
- * Default old SAX v1 handler for SGML DocBook, builds the DOM tree
- */
-xmlSAXHandlerV1 docbDefaultSAXHandler = {
- xmlSAX2InternalSubset,
- xmlSAX2IsStandalone,
- xmlSAX2HasInternalSubset,
- xmlSAX2HasExternalSubset,
- xmlSAX2ResolveEntity,
- xmlSAX2GetEntity,
- xmlSAX2EntityDecl,
- NULL,
- NULL,
- NULL,
- NULL,
- xmlSAX2SetDocumentLocator,
- xmlSAX2StartDocument,
- xmlSAX2EndDocument,
- xmlSAX2StartElement,
- xmlSAX2EndElement,
- xmlSAX2Reference,
- xmlSAX2Characters,
- xmlSAX2IgnorableWhitespace,
- NULL,
- xmlSAX2Comment,
- xmlParserWarning,
- xmlParserError,
- xmlParserError,
- xmlSAX2GetParameterEntity,
- NULL,
- NULL,
- 0,
-};
-#endif /* LIBXML_DOCB_ENABLED */
-
/**
* xmlInitializeGlobalState:
* @gs: a pointer to a newly allocated global state
@@ -490,8 +498,8 @@ void
xmlInitializeGlobalState(xmlGlobalStatePtr gs)
{
#ifdef DEBUG_GLOBALS
- fprintf(stderr, "Initializing globals at %lu for thread %d\n",
- (unsigned long) gs, xmlGetThreadId());
+ fprintf(stderr, "Initializing globals at %p for thread %d\n",
+ (void *) gs, xmlGetThreadId());
#endif
/*
@@ -502,9 +510,6 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
xmlMutexLock(xmlThrDefMutex);
-#if defined(LIBXML_DOCB_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
- initdocbDefaultSAXHandler(&gs->docbDefaultSAXHandler);
-#endif
#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
#endif
@@ -562,9 +567,26 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
}
/**
- * DOC_DISABLE : we ignore missing doc for the xmlThrDef functions,
- * those are really internal work
+ * xmlCleanupGlobals:
+ *
+ * DEPRECATED: This function will be made private. Call xmlCleanupParser
+ * to free global state but see the warnings there. xmlCleanupParser
+ * should be only called once at program exit. In most cases, you don't
+ * have call cleanup functions at all.
+ *
+ * Additional cleanup for multi-threading
*/
+void xmlCleanupGlobals(void)
+{
+ xmlResetError(&xmlLastError);
+
+ if (xmlThrDefMutex != NULL) {
+ xmlFreeMutex(xmlThrDefMutex);
+ xmlThrDefMutex = NULL;
+ }
+ __xmlGlobalInitMutexDestroy();
+}
+
void
xmlThrDefSetGenericErrorFunc(void *ctx, xmlGenericErrorFunc handler) {
xmlMutexLock(xmlThrDefMutex);
@@ -685,18 +707,7 @@ xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc fun
return(old);
}
-#ifdef LIBXML_DOCB_ENABLED
-#undef docbDefaultSAXHandler
-xmlSAXHandlerV1 *
-__docbDefaultSAXHandler(void) {
- if (IS_MAIN_THREAD)
- return (&docbDefaultSAXHandler);
- else
- return (&xmlGetGlobalState()->docbDefaultSAXHandler);
-}
-#endif
-
-#ifdef LIBXML_HTML_ENABLED
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_SAX1_ENABLED)
#undef htmlDefaultSAXHandler
xmlSAXHandlerV1 *
__htmlDefaultSAXHandler(void) {
@@ -1106,19 +1117,3 @@ __xmlOutputBufferCreateFilenameValue(void) {
return (&xmlGetGlobalState()->xmlOutputBufferCreateFilenameValue);
}
-/**
- * xmlCleanupGlobals:
- *
- * Additional cleanup for multi-threading
- */
-void xmlCleanupGlobals(void)
-{
- xmlResetError(&xmlLastError);
-
- if (xmlThrDefMutex != NULL) {
- xmlFreeMutex(xmlThrDefMutex);
- xmlThrDefMutex = NULL;
- }
- __xmlGlobalInitMutexDestroy();
-}
-