Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(981)

Unified Diff: third_party/libxml/src/globals.c

Issue 1193533007: Upgrade to libxml 2.9.2 and libxslt 1.1.28 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no iconv Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libxml/src/error.c ('k') | third_party/libxml/src/hash.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxml/src/globals.c
diff --git a/third_party/libxml/src/globals.c b/third_party/libxml/src/globals.c
index b369346994821b79e5510c099bafb65608b54765..e351b03ff5c0098cb42dc9ef352c01d9eaf3758a 100644
--- a/third_party/libxml/src/globals.c
+++ b/third_party/libxml/src/globals.c
@@ -65,9 +65,9 @@ void xmlCleanupGlobals(void)
}
/************************************************************************
- * *
+ * *
* All the user accessible global variables of the library *
- * *
+ * *
************************************************************************/
/*
@@ -86,25 +86,6 @@ xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) xmlMemMalloc;
xmlReallocFunc xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
-
-#define MAX_LIBXML_MALLOC (1024*1024*512)
-
-static void* size_checked_malloc(size_t size) {
- if (size > MAX_LIBXML_MALLOC) {
- *(volatile char*)0 = '\0';
- return NULL;
- }
- return malloc(size);
-}
-
-static void* size_checked_realloc(void* ptr, size_t size) {
- if (size > MAX_LIBXML_MALLOC) {
- *(volatile char*)0 = '\0';
- return NULL;
- }
- return realloc(ptr, size);
-}
-
/**
* xmlFree:
* @mem: an already allocated block of memory
@@ -120,7 +101,7 @@ xmlFreeFunc xmlFree = (xmlFreeFunc) free;
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
-xmlMallocFunc xmlMalloc = (xmlMallocFunc) size_checked_malloc;
+xmlMallocFunc xmlMalloc = (xmlMallocFunc) malloc;
/**
* xmlMallocAtomic:
* @size: the size requested in bytes
@@ -131,7 +112,7 @@ xmlMallocFunc xmlMalloc = (xmlMallocFunc) size_checked_malloc;
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
-xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) size_checked_malloc;
+xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) malloc;
/**
* xmlRealloc:
* @mem: an already allocated block of memory
@@ -141,7 +122,7 @@ xmlMallocFunc xmlMallocAtomic = (xmlMallocFunc) size_checked_malloc;
*
* Returns a pointer to the newly reallocated block or NULL in case of error
*/
-xmlReallocFunc xmlRealloc = (xmlReallocFunc) size_checked_realloc;
+xmlReallocFunc xmlRealloc = (xmlReallocFunc) realloc;
/**
* xmlMemStrdup:
* @str: a zero terminated string
@@ -265,7 +246,7 @@ static int xmlPedanticParserDefaultValueThrDef = 0;
* xmlLineNumbersDefaultValue:
*
* Global setting, indicate that the parser should store the line number
- * in the content field of elements in the DOM tree.
+ * in the content field of elements in the DOM tree.
* Disabled by default since this may not be safe for old classes of
* applicaton.
*/
@@ -528,7 +509,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
#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)
+#if defined(LIBXML_HTML_ENABLED) && defined(LIBXML_LEGACY_ENABLED) && defined(LIBXML_SAX1_ENABLED)
inithtmlDefaultSAXHandler(&gs->htmlDefaultSAXHandler);
#endif
@@ -542,7 +523,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlDefaultSAXLocator.getSystemId = xmlSAX2GetSystemId;
gs->xmlDefaultSAXLocator.getLineNumber = xmlSAX2GetLineNumber;
gs->xmlDefaultSAXLocator.getColumnNumber = xmlSAX2GetColumnNumber;
- gs->xmlDoValidityCheckingDefaultValue =
+ gs->xmlDoValidityCheckingDefaultValue =
xmlDoValidityCheckingDefaultValueThrDef;
#if defined(DEBUG_MEMORY_LOCATION) | defined(DEBUG_MEMORY)
gs->xmlFree = (xmlFreeFunc) xmlMemFree;
@@ -567,7 +548,7 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlParserVersion = LIBXML_VERSION_STRING;
gs->xmlPedanticParserDefaultValue = xmlPedanticParserDefaultValueThrDef;
gs->xmlSaveNoEmptyTags = xmlSaveNoEmptyTagsThrDef;
- gs->xmlSubstituteEntitiesDefaultValue =
+ gs->xmlSubstituteEntitiesDefaultValue =
xmlSubstituteEntitiesDefaultValueThrDef;
gs->xmlGenericError = xmlGenericErrorThrDef;
@@ -619,7 +600,7 @@ xmlRegisterNodeFunc
xmlRegisterNodeDefault(xmlRegisterNodeFunc func)
{
xmlRegisterNodeFunc old = xmlRegisterNodeDefaultValue;
-
+
__xmlRegisterCallbacks = 1;
xmlRegisterNodeDefaultValue = func;
return(old);
@@ -629,10 +610,10 @@ xmlRegisterNodeFunc
xmlThrDefRegisterNodeDefault(xmlRegisterNodeFunc func)
{
xmlRegisterNodeFunc old;
-
+
xmlMutexLock(xmlThrDefMutex);
old = xmlRegisterNodeDefaultValueThrDef;
-
+
__xmlRegisterCallbacks = 1;
xmlRegisterNodeDefaultValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
@@ -652,7 +633,7 @@ xmlDeregisterNodeFunc
xmlDeregisterNodeDefault(xmlDeregisterNodeFunc func)
{
xmlDeregisterNodeFunc old = xmlDeregisterNodeDefaultValue;
-
+
__xmlRegisterCallbacks = 1;
xmlDeregisterNodeDefaultValue = func;
return(old);
@@ -665,7 +646,7 @@ xmlThrDefDeregisterNodeDefault(xmlDeregisterNodeFunc func)
xmlMutexLock(xmlThrDefMutex);
old = xmlDeregisterNodeDefaultValueThrDef;
-
+
__xmlRegisterCallbacks = 1;
xmlDeregisterNodeDefaultValueThrDef = func;
xmlMutexUnlock(xmlThrDefMutex);
@@ -677,7 +658,7 @@ xmlParserInputBufferCreateFilenameFunc
xmlThrDefParserInputBufferCreateFilenameDefault(xmlParserInputBufferCreateFilenameFunc func)
{
xmlParserInputBufferCreateFilenameFunc old;
-
+
xmlMutexLock(xmlThrDefMutex);
old = xmlParserInputBufferCreateFilenameValueThrDef;
if (old == NULL) {
@@ -694,7 +675,7 @@ xmlOutputBufferCreateFilenameFunc
xmlThrDefOutputBufferCreateFilenameDefault(xmlOutputBufferCreateFilenameFunc func)
{
xmlOutputBufferCreateFilenameFunc old;
-
+
xmlMutexLock(xmlThrDefMutex);
old = xmlOutputBufferCreateFilenameValueThrDef;
#ifdef LIBXML_OUTPUT_ENABLED
@@ -751,7 +732,7 @@ __xmlMalloc(void){
if (IS_MAIN_THREAD)
return (&xmlMalloc);
else
- return (&xmlGetGlobalState()->xmlMalloc);
+ return (&xmlGetGlobalState()->xmlMalloc);
}
#undef xmlMallocAtomic
« no previous file with comments | « third_party/libxml/src/error.c ('k') | third_party/libxml/src/hash.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698