1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-09 04:58:16 +03:00

Hide internal functions

These functions were never declared in public headers, so it should be
safe to hide them.

Fixes #139.
This commit is contained in:
Nick Wellnhofer 2022-11-27 02:09:27 +01:00
parent 82bd2c3736
commit ccb6d54409
19 changed files with 140 additions and 72 deletions

View File

@ -3,45 +3,68 @@
#include <libxml/tree.h>
xmlBufPtr xmlBufCreate(void);
xmlBufPtr xmlBufCreateSize(size_t size);
XML_HIDDEN xmlBufPtr
xmlBufCreate(void);
XML_HIDDEN xmlBufPtr
xmlBufCreateSize(size_t size);
int xmlBufSetAllocationScheme(xmlBufPtr buf,
xmlBufferAllocationScheme scheme);
int xmlBufGetAllocationScheme(xmlBufPtr buf);
XML_HIDDEN int
xmlBufSetAllocationScheme(xmlBufPtr buf, xmlBufferAllocationScheme scheme);
XML_HIDDEN int
xmlBufGetAllocationScheme(xmlBufPtr buf);
void xmlBufFree(xmlBufPtr buf);
void xmlBufEmpty(xmlBufPtr buf);
XML_HIDDEN void
xmlBufFree(xmlBufPtr buf);
XML_HIDDEN void
xmlBufEmpty(xmlBufPtr buf);
/* size_t xmlBufShrink(xmlBufPtr buf, size_t len); */
int xmlBufGrow(xmlBufPtr buf, int len);
int xmlBufResize(xmlBufPtr buf, size_t len);
XML_HIDDEN int
xmlBufGrow(xmlBufPtr buf, int len);
XML_HIDDEN int
xmlBufResize(xmlBufPtr buf, size_t len);
int xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
int xmlBufCat(xmlBufPtr buf, const xmlChar *str);
int xmlBufCCat(xmlBufPtr buf, const char *str);
int xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
XML_HIDDEN int
xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len);
XML_HIDDEN int
xmlBufCat(xmlBufPtr buf, const xmlChar *str);
XML_HIDDEN int
xmlBufCCat(xmlBufPtr buf, const char *str);
XML_HIDDEN int
xmlBufWriteQuotedString(xmlBufPtr buf, const xmlChar *string);
size_t xmlBufAvail(const xmlBufPtr buf);
size_t xmlBufLength(const xmlBufPtr buf);
XML_HIDDEN size_t
xmlBufAvail(const xmlBufPtr buf);
XML_HIDDEN size_t
xmlBufLength(const xmlBufPtr buf);
/* size_t xmlBufUse(const xmlBufPtr buf); */
int xmlBufIsEmpty(const xmlBufPtr buf);
int xmlBufAddLen(xmlBufPtr buf, size_t len);
XML_HIDDEN int
xmlBufIsEmpty(const xmlBufPtr buf);
XML_HIDDEN int
xmlBufAddLen(xmlBufPtr buf, size_t len);
/* const xmlChar * xmlBufContent(const xmlBuf *buf); */
/* const xmlChar * xmlBufEnd(xmlBufPtr buf); */
xmlChar * xmlBufDetach(xmlBufPtr buf);
XML_HIDDEN xmlChar *
xmlBufDetach(xmlBufPtr buf);
size_t xmlBufDump(FILE *file, xmlBufPtr buf);
XML_HIDDEN size_t
xmlBufDump(FILE *file, xmlBufPtr buf);
xmlBufPtr xmlBufFromBuffer(xmlBufferPtr buffer);
xmlBufferPtr xmlBufBackToBuffer(xmlBufPtr buf);
int xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
XML_HIDDEN xmlBufPtr
xmlBufFromBuffer(xmlBufferPtr buffer);
XML_HIDDEN xmlBufferPtr
xmlBufBackToBuffer(xmlBufPtr buf);
XML_HIDDEN int
xmlBufMergeBuffer(xmlBufPtr buf, xmlBufferPtr buffer);
int xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
size_t xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
int xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
size_t base, size_t cur);
XML_HIDDEN int
xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input);
XML_HIDDEN size_t
xmlBufGetInputBase(xmlBufPtr buf, xmlParserInputPtr input);
XML_HIDDEN int
xmlBufSetInputBaseCur(xmlBufPtr buf, xmlParserInputPtr input,
size_t base, size_t cur);
#endif /* XML_BUF_H_PRIVATE__ */

View File

@ -1,8 +1,11 @@
#ifndef XML_DICT_H_PRIVATE__
#define XML_DICT_H_PRIVATE__
int __xmlInitializeDict(void);
void xmlCleanupDictInternal(void);
int __xmlRandom(void);
XML_HIDDEN int
__xmlInitializeDict(void);
XML_HIDDEN void
xmlCleanupDictInternal(void);
XML_HIDDEN int
__xmlRandom(void);
#endif /* XML_DICT_H_PRIVATE__ */

View File

@ -4,10 +4,14 @@
#include <libxml/encoding.h>
#include <libxml/tree.h>
void xmlInitEncodingInternal(void);
XML_HIDDEN void
xmlInitEncodingInternal(void);
int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
int xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
int xmlCharEncOutput(xmlOutputBufferPtr output, int init);
XML_HIDDEN int
xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len);
XML_HIDDEN int
xmlCharEncInput(xmlParserInputBufferPtr input, int flush);
XML_HIDDEN int
xmlCharEncOutput(xmlOutputBufferPtr output, int init);
#endif /* XML_ENC_H_PRIVATE__ */

View File

@ -4,6 +4,7 @@
#include <libxml/tree.h>
#include <libxml/xmlstring.h>
xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
XML_HIDDEN xmlChar *
xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input);
#endif /* XML_ENTITIES_H_PRIVATE__ */

View File

@ -4,17 +4,17 @@
#include <libxml/xmlerror.h>
#include <libxml/xmlversion.h>
void
XML_HIDDEN void
__xmlRaiseError(xmlStructuredErrorFunc schannel,
xmlGenericErrorFunc channel, void *data, void *ctx,
void *nod, int domain, int code, xmlErrorLevel level,
const char *file, int line, const char *str1,
const char *str2, const char *str3, int int1, int col,
const char *msg, ...) LIBXML_ATTR_FORMAT(16,17);
void
XML_HIDDEN void
__xmlSimpleError(int domain, int code, xmlNodePtr node,
const char *msg, const char *extra) LIBXML_ATTR_FORMAT(4,0);
void
XML_HIDDEN void
xmlGenericErrorDefaultFunc(void *ctx, const char *msg,
...) LIBXML_ATTR_FORMAT(2,3);

View File

@ -1,7 +1,9 @@
#ifndef XML_GLOBALS_H_PRIVATE__
#define XML_GLOBALS_H_PRIVATE__
void xmlInitGlobalsInternal(void);
void xmlCleanupGlobalsInternal(void);
XML_HIDDEN void
xmlInitGlobalsInternal(void);
XML_HIDDEN void
xmlCleanupGlobalsInternal(void);
#endif /* XML_GLOBALS_H_PRIVATE__ */

View File

@ -5,7 +5,8 @@
#ifdef LIBXML_HTML_ENABLED
void __htmlParseContent(void *ctx);
XML_HIDDEN void
__htmlParseContent(void *ctx);
#endif /* LIBXML_HTML_ENABLED */

View File

@ -5,12 +5,14 @@
#include <libxml/tree.h>
#include <libxml/xmlversion.h>
void __xmlIOErr(int domain, int code, const char *extra);
void __xmlLoaderErr(void *ctx, const char *msg,
const char *filename) LIBXML_ATTR_FORMAT(2,0);
XML_HIDDEN void
__xmlIOErr(int domain, int code, const char *extra);
XML_HIDDEN void
__xmlLoaderErr(void *ctx, const char *msg,
const char *filename) LIBXML_ATTR_FORMAT(2,0);
#ifdef LIBXML_OUTPUT_ENABLED
xmlOutputBufferPtr
XML_HIDDEN xmlOutputBufferPtr
xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder);
#endif

View File

@ -1,7 +1,9 @@
#ifndef XML_MEMORY_H_PRIVATE__
#define XML_MEMORY_H_PRIVATE__
void xmlInitMemoryInternal(void);
void xmlCleanupMemoryInternal(void);
XML_HIDDEN void
xmlInitMemoryInternal(void);
XML_HIDDEN void
xmlCleanupMemoryInternal(void);
#endif /* XML_MEMORY_H_PRIVATE__ */

View File

@ -17,9 +17,11 @@
*/
#define XML_VCTXT_USE_PCTXT (1u << 1)
void xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
void __xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
const char *msg, const xmlChar *str1,
const xmlChar *str2) LIBXML_ATTR_FORMAT(3,0);
XML_HIDDEN void
xmlErrMemory(xmlParserCtxtPtr ctxt, const char *extra);
XML_HIDDEN void
__xmlErrEncoding(xmlParserCtxtPtr ctxt, xmlParserErrors xmlerr,
const char *msg, const xmlChar *str1,
const xmlChar *str2) LIBXML_ATTR_FORMAT(3,0);
#endif /* XML_PARSER_H_PRIVATE__ */

View File

@ -3,6 +3,7 @@
#include <libxml/xmlautomata.h>
void xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
XML_HIDDEN void
xmlAutomataSetFlags(xmlAutomataPtr am, int flags);
#endif /* XML_REGEXP_H_PRIVATE__ */

View File

@ -6,9 +6,11 @@
#ifdef LIBXML_OUTPUT_ENABLED
void xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
xmlAttrPtr attr, const xmlChar * string);
void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
XML_HIDDEN void
xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc,
xmlAttrPtr attr, const xmlChar * string);
XML_HIDDEN void
xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur);
#endif /* LIBXML_OUTPUT_ENABLED */

View File

@ -3,6 +3,7 @@
#include <libxml/xmlstring.h>
xmlChar *xmlEscapeFormatString(xmlChar **msg);
XML_HIDDEN xmlChar *
xmlEscapeFormatString(xmlChar **msg);
#endif /* XML_STRING_H_PRIVATE__ */

View File

@ -30,14 +30,21 @@ struct _xmlMutex {
#endif
};
void __xmlGlobalInitMutexLock(void);
void __xmlGlobalInitMutexUnlock(void);
void __xmlGlobalInitMutexDestroy(void);
XML_HIDDEN void
__xmlGlobalInitMutexLock(void);
XML_HIDDEN void
__xmlGlobalInitMutexUnlock(void);
XML_HIDDEN void
__xmlGlobalInitMutexDestroy(void);
void xmlInitThreadsInternal(void);
void xmlCleanupThreadsInternal(void);
XML_HIDDEN void
xmlInitThreadsInternal(void);
XML_HIDDEN void
xmlCleanupThreadsInternal(void);
void xmlInitMutex(xmlMutexPtr mutex);
void xmlCleanupMutex(xmlMutexPtr mutex);
XML_HIDDEN void
xmlInitMutex(xmlMutexPtr mutex);
XML_HIDDEN void
xmlCleanupMutex(xmlMutexPtr mutex);
#endif /* XML_THREADS_H_PRIVATE__ */

View File

@ -6,12 +6,13 @@
* node creation/destruction. It avoids spending a lot of time in locking
* function while checking if the callback exists.
*/
extern int __xmlRegisterCallbacks;
XML_HIDDEN extern int
__xmlRegisterCallbacks;
xmlNodePtr
XML_HIDDEN xmlNodePtr
xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent,
int extended);
xmlNodePtr
XML_HIDDEN xmlNodePtr
xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent);
#endif /* XML_TREE_H_PRIVATE__ */

View File

@ -3,6 +3,7 @@
#include <libxml/xinclude.h>
int xmlXIncludeSetStreamingMode(xmlXIncludeCtxtPtr ctxt, int mode);
XML_HIDDEN int
xmlXIncludeSetStreamingMode(xmlXIncludeCtxtPtr ctxt, int mode);
#endif /* XML_IO_H_PRIVATE__ */

View File

@ -1,6 +1,7 @@
#ifndef XML_XPATH_H_PRIVATE__
#define XML_XPATH_H_PRIVATE__
void xmlInitXPathInternal(void);
XML_HIDDEN void
xmlInitXPathInternal(void);
#endif /* XML_XPATH_H_PRIVATE__ */

View File

@ -16,11 +16,16 @@
typedef void *xzFile; /* opaque lzma file descriptor */
xzFile __libxml2_xzopen(const char *path, const char *mode);
xzFile __libxml2_xzdopen(int fd, const char *mode);
int __libxml2_xzread(xzFile file, void *buf, unsigned len);
int __libxml2_xzclose(xzFile file);
int __libxml2_xzcompressed(xzFile f);
XML_HIDDEN xzFile
__libxml2_xzopen(const char *path, const char *mode);
XML_HIDDEN xzFile
__libxml2_xzdopen(int fd, const char *mode);
XML_HIDDEN int
__libxml2_xzread(xzFile file, void *buf, unsigned len);
XML_HIDDEN int
__libxml2_xzclose(xzFile file);
XML_HIDDEN int
__libxml2_xzcompressed(xzFile f);
#endif /* LIBXML_LZMA_ENABLED */

View File

@ -54,6 +54,15 @@ int vfprintf(FILE *, const char *, va_list);
#include "trio.h"
#endif
#if !defined(_WIN32) && \
!defined(__CYGWIN__) && \
(defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 4)))
#define XML_HIDDEN __attribute__((visibility("hidden")))
#else
#define XML_HIDDEN
#endif
#if defined(__clang__) || \
(defined(__GNUC__) && (__GNUC__ >= 8))
#define ATTRIBUTE_NO_SANITIZE(arg) __attribute__((no_sanitize(arg)))