Skip to content

Commit

Permalink
Remove some libxml Starboardizations (#3916)
Browse files Browse the repository at this point in the history
malloc/free changes are no longer necessary with SB16

b/150410605
  • Loading branch information
kaidokert authored Jul 31, 2024
1 parent 1f7d8a5 commit 21eb395
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 225 deletions.
131 changes: 0 additions & 131 deletions third_party/libxml/port.py

This file was deleted.

16 changes: 8 additions & 8 deletions third_party/libxml/src/globals.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ xmlStrdupFunc xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
*
* The variable holding the libxml free() implementation
*/
xmlFreeFunc xmlFree = XML_FREE;
xmlFreeFunc xmlFree = free;
/**
* xmlMalloc:
* @size: the size requested in bytes
Expand All @@ -85,7 +85,7 @@ xmlFreeFunc xmlFree = XML_FREE;
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
xmlMallocFunc xmlMalloc = XML_MALLOC;
xmlMallocFunc xmlMalloc = malloc;
/**
* xmlMallocAtomic:
* @size: the size requested in bytes
Expand All @@ -96,7 +96,7 @@ xmlMallocFunc xmlMalloc = XML_MALLOC;
*
* Returns a pointer to the newly allocated block or NULL in case of error
*/
xmlMallocFunc xmlMallocAtomic = XML_MALLOC;
xmlMallocFunc xmlMallocAtomic = malloc;
/**
* xmlRealloc:
* @mem: an already allocated block of memory
Expand All @@ -106,7 +106,7 @@ xmlMallocFunc xmlMallocAtomic = XML_MALLOC;
*
* Returns a pointer to the newly reallocated block or NULL in case of error
*/
xmlReallocFunc xmlRealloc = XML_REALLOC;
xmlReallocFunc xmlRealloc = realloc;
/**
* xmlPosixStrdup
* @cur: the input char *
Expand Down Expand Up @@ -528,10 +528,10 @@ xmlInitializeGlobalState(xmlGlobalStatePtr gs)
gs->xmlRealloc = (xmlReallocFunc) xmlMemRealloc;
gs->xmlMemStrdup = (xmlStrdupFunc) xmlMemoryStrdup;
#else
gs->xmlFree = (xmlFreeFunc) XML_FREE;
gs->xmlMalloc = (xmlMallocFunc) XML_MALLOC;
gs->xmlMallocAtomic = (xmlMallocFunc) XML_MALLOC;
gs->xmlRealloc = (xmlReallocFunc) XML_REALLOC;
gs->xmlFree = (xmlFreeFunc) free;
gs->xmlMalloc = (xmlMallocFunc) malloc;
gs->xmlMallocAtomic = (xmlMallocFunc) malloc;
gs->xmlRealloc = (xmlReallocFunc) realloc;
gs->xmlMemStrdup = (xmlStrdupFunc) xmlStrdup;
#endif
gs->xmlGetWarningsDefaultValue = xmlGetWarningsDefaultValueThrDef;
Expand Down
5 changes: 5 additions & 0 deletions third_party/libxml/src/include/libxml/valid.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,20 +283,25 @@ XMLPUBFUN int XMLCALL
xmlAttrPtr attr);

/* IDREFs */
XML_DEPRECATED
XMLPUBFUN xmlRefPtr XMLCALL
xmlAddRef (xmlValidCtxtPtr ctxt,
xmlDocPtr doc,
const xmlChar *value,
xmlAttrPtr attr);
XML_DEPRECATED
XMLPUBFUN void XMLCALL
xmlFreeRefTable (xmlRefTablePtr table);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlIsRef (xmlDocPtr doc,
xmlNodePtr elem,
xmlAttrPtr attr);
XML_DEPRECATED
XMLPUBFUN int XMLCALL
xmlRemoveRef (xmlDocPtr doc,
xmlAttrPtr attr);
XML_DEPRECATED
XMLPUBFUN xmlListPtr XMLCALL
xmlGetRefs (xmlDocPtr doc,
const xmlChar *ID);
Expand Down
12 changes: 3 additions & 9 deletions third_party/libxml/src/libxml.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,10 @@ int vfprintf(FILE *, const char *, va_list);
#define XML_POP_WARNINGS
#endif

#if defined(__clang__) && defined(__has_attribute)
#if __has_attribute(no_sanitize)
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
#endif
#elif (defined(__GNUC__) && (__GNUC__ >= 8))
#if defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 8))
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))
#endif
#if !defined(ATTRIBUTE_NO_SANITIZE)
#else
#define ATTRIBUTE_NO_SANITIZE(arg)
#endif

Expand Down Expand Up @@ -99,12 +95,10 @@ void __xmlGlobalInitMutexDestroy(void);

int __xmlInitializeDict(void);

#if defined(HAVE_RAND) && defined(HAVE_SRAND) && defined(HAVE_TIME)
/*
* internal thread safe random function
*/
int __xmlRandom(void);
#endif

XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg);
int xmlInputReadCallbackNop(void *context, char *buffer, int len);
Expand Down
Loading

0 comments on commit 21eb395

Please sign in to comment.