diff options
64 files changed, 308 insertions, 337 deletions
diff --git a/HTMLparser.c b/HTMLparser.c index 4efa7b00..d5fb6ae3 100644 --- a/HTMLparser.c +++ b/HTMLparser.c @@ -28,8 +28,12 @@ #include <libxml/globals.h> #include <libxml/uri.h> -#include "buf.h" -#include "enc.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/html.h" +#include "private/parser.h" +#include "private/tree.h" #define HTML_MAX_NAMELEN 1000 #define HTML_PARSER_BIG_BUFFER_SIZE 1000 @@ -25,7 +25,10 @@ #include <libxml/globals.h> #include <libxml/uri.h> -#include "buf.h" +#include "private/buf.h" +#include "private/error.h" +#include "private/io.h" +#include "private/save.h" /************************************************************************ * * @@ -328,11 +331,6 @@ htmlIsBooleanAttr(const xmlChar *name) } #ifdef LIBXML_OUTPUT_ENABLED -/* - * private routine exported from xmlIO.c - */ -xmlOutputBufferPtr -xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); /************************************************************************ * * * Output error handlers * @@ -622,8 +620,6 @@ htmlDocDumpMemory(xmlDocPtr cur, xmlChar**mem, int *size) { * * ************************************************************************/ -void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); - /** * htmlDtdDumpOutput: * @buf: the HTML buffer output diff --git a/Makefile.am b/Makefile.am index f5820d15..be404421 100644 --- a/Makefile.am +++ b/Makefile.am @@ -395,8 +395,8 @@ EXTRA_DIST = xml2-config.in libxml.spec.in \ libxml-2.0.pc.in libxml-2.0-uninstalled.pc.in \ libxml2-config.cmake.in autogen.sh \ trionan.c trionan.h triostr.c triostr.h trio.c trio.h \ - triop.h triodef.h libxml.h xzlib.h buf.h \ - enc.h save.h genUnicode.py TODO_SCHEMAS \ + triop.h triodef.h libxml.h \ + genUnicode.py TODO_SCHEMAS \ dbgen.pl dbgenattr.pl \ README.tests Makefile.tests libxml2.syms timsort.h \ README.zOS README.md \ @@ -28,6 +28,10 @@ #include <libxml/HTMLtree.h> #include <libxml/globals.h> +#include "private/error.h" +#include "private/parser.h" +#include "private/tree.h" + /* Define SIZE_T_MAX unless defined through <limits.h>. */ #ifndef SIZE_T_MAX # define SIZE_T_MAX ((size_t)-1) @@ -24,7 +24,9 @@ #include <libxml/globals.h> #include <libxml/tree.h> #include <libxml/parserInternals.h> /* for XML_MAX_TEXT_LENGTH */ -#include "buf.h" + +#include "private/buf.h" +#include "private/error.h" #ifndef SIZE_MAX #define SIZE_MAX ((size_t) -1) @@ -25,7 +25,8 @@ #include <libxml/xpathInternals.h> #include <libxml/c14n.h> -#include "buf.h" +#include "private/buf.h" +#include "private/error.h" /************************************************************************ * * @@ -39,7 +39,8 @@ #include <libxml/threads.h> #include <libxml/globals.h> -#include "buf.h" +#include "private/buf.h" +#include "private/error.h" #define MAX_DELEGATE 50 #define MAX_CATAL_DEPTH 50 diff --git a/configure.ac b/configure.ac index 44ee6eb1..161672f3 100644 --- a/configure.ac +++ b/configure.ac @@ -1437,7 +1437,7 @@ AC_SUBST(RELDATE) AC_SUBST(PYTHON_TESTS) # keep on one line for cygwin c.f. #130896 -AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake]) +AC_CONFIG_FILES([libxml2.spec:libxml.spec.in Makefile include/Makefile include/libxml/Makefile include/private/Makefile doc/Makefile doc/examples/Makefile doc/devhelp/Makefile example/Makefile fuzz/Makefile python/Makefile python/tests/Makefile xstc/Makefile include/libxml/xmlversion.h libxml-2.0.pc libxml-2.0-uninstalled.pc libxml2-config.cmake]) AC_CONFIG_FILES([python/setup.py], [chmod +x python/setup.py]) AC_CONFIG_FILES([xml2-config], [chmod +x xml2-config]) AC_OUTPUT @@ -30,6 +30,8 @@ #include <libxml/relaxng.h> #endif +#include "private/error.h" + #define DUMP_TEXT_TYPE 1 typedef struct _xmlDebugCtxt xmlDebugCtxt; @@ -23,6 +23,8 @@ #include <stdlib.h> #include <time.h> +#include "private/dict.h" + /* * Following http://www.ocert.org/advisories/ocert-2011-003.html * it seems that having hash randomization might be a good idea diff --git a/doc/apibuild.py b/doc/apibuild.py index 4848b931..dff5c573 100755 --- a/doc/apibuild.py +++ b/doc/apibuild.py @@ -23,14 +23,12 @@ ignored_files = { "trio.c": "too many non standard macros", "trionan.c": "too many non standard macros", "triostr.c": "too many non standard macros", - "acconfig.h": "generated portability layer", "config.h": "generated portability layer", "libxml.h": "internal only", "testOOM.c": "out of memory tester", "testOOMlib.h": "out of memory tester", "testOOMlib.c": "out of memory tester", "rngparser.c": "not yet integrated", - "rngparser.h": "not yet integrated", "testAutomata.c": "test tool", "testModule.c": "test tool", "testThreads.c": "test tool", @@ -41,10 +39,6 @@ ignored_files = { "test.c": "not part of the library", "testdso.c": "test for dynamid shared libraries", "testrecurse.c": "test for entities recursions", - "xzlib.h": "Internal API only 2.8.0", - "buf.h": "Internal API only 2.9.0", - "enc.h": "Internal API only 2.9.0", - "/save.h": "Internal API only 2.9.0", "timsort.h": "Internal header only for xpath.c 2.9.0", } @@ -1,32 +0,0 @@ -/* - * Summary: Internal Interfaces for encoding in libxml2 - * Description: this module describes a few interfaces which were - * added along with the API changes in 2.9.0 - * those are private routines at this point - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_ENC_H__ -#define __XML_ENC_H__ - -#include <libxml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -int xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in, int len); -int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len); -int xmlCharEncInput(xmlParserInputBufferPtr input, int flush); -int xmlCharEncOutput(xmlOutputBufferPtr output, int init); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_ENC_H__ */ - - @@ -40,8 +40,9 @@ #include <libxml/globals.h> #include <libxml/xmlerror.h> -#include "buf.h" -#include "enc.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" #ifdef LIBXML_ICU_ENABLED #include <unicode/ucnv.h> @@ -2056,11 +2057,10 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, } /** - * xmlCharEncFirstLineInt: + * xmlCharEncFirstLine: * @handler: char encoding transformation data structure * @out: an xmlBuffer for the output. * @in: an xmlBuffer for the input - * @len: number of bytes to convert for the first line, or -1 * * Front-end for the encoding handler input function, but handle only * the very first line, i.e. limit itself to 45 chars. @@ -2071,8 +2071,8 @@ xmlEncOutputChunk(xmlCharEncodingHandler *handler, unsigned char *out, * the result of transformation can't fit into the encoding we want), or */ int -xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in, int len) { +xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, + xmlBufferPtr in) { int ret; int written; int toconv; @@ -2092,13 +2092,8 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, * The actual value depending on guessed encoding is passed as @len * if provided */ - if (len >= 0) { - if (toconv > len) - toconv = len; - } else { - if (toconv > 180) - toconv = 180; - } + if (toconv > 180) + toconv = 180; if (toconv * 2 >= written) { xmlBufferGrow(out, toconv * 2); written = out->size - out->use - 1; @@ -2143,26 +2138,6 @@ xmlCharEncFirstLineInt(xmlCharEncodingHandler *handler, xmlBufferPtr out, } /** - * xmlCharEncFirstLine: - * @handler: char encoding transformation data structure - * @out: an xmlBuffer for the output. - * @in: an xmlBuffer for the input - * - * Front-end for the encoding handler input function, but handle only - * the very first line, i.e. limit itself to 45 chars. - * - * Returns the number of byte written if success, or - * -1 general error - * -2 if the transcoding fails (for *in is not valid utf8 string or - * the result of transformation can't fit into the encoding we want), or - */ -int -xmlCharEncFirstLine(xmlCharEncodingHandler *handler, xmlBufferPtr out, - xmlBufferPtr in) { - return(xmlCharEncFirstLineInt(handler, out, in, -1)); -} - -/** * xmlCharEncFirstLineInput: * @input: a parser input buffer * @len: number of bytes to convert for the first line, or -1 @@ -26,7 +26,8 @@ #include <libxml/globals.h> #include <libxml/dict.h> -#include "save.h" +#include "private/entities.h" +#include "private/error.h" /* * The XML predefined entities. @@ -16,9 +16,7 @@ #include <libxml/xmlmemory.h> #include <libxml/globals.h> -void XMLCDECL xmlGenericErrorDefaultFunc (void *ctx ATTRIBUTE_UNUSED, - const char *msg, - ...) LIBXML_ATTR_FORMAT(2,3); +#include "private/error.h" #define XML_GET_VAR_STR(msg, str) { \ int size, prev_size = -1; \ @@ -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 */ /* @@ -325,15 +329,6 @@ static xmlParserInputBufferCreateFilenameFunc xmlParserInputBufferCreateFilename 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: * @@ -39,6 +39,8 @@ #include <libxml/xmlerror.h> #include <libxml/globals.h> +#include "private/dict.h" + #define MAX_HASH_LEN 8 /* #define DEBUG_GROW */ diff --git a/include/Makefile.am b/include/Makefile.am index 7dbfaa5b..2603acc6 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -1,5 +1,5 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS=libxml +SUBDIRS=libxml private EXTRA_DIST = win32config.h wsockcompat.h diff --git a/include/libxml/parserInternals.h b/include/libxml/parserInternals.h index 191ec784..7cb0f517 100644 --- a/include/libxml/parserInternals.h +++ b/include/libxml/parserInternals.h @@ -317,16 +317,6 @@ XMLPUBFUN int XMLCALL xmlParserInputPtr input, xmlCharEncodingHandlerPtr handler); -#ifdef IN_LIBXML -/* internal error reporting */ -XMLPUBFUN void XMLCALL - __xmlErrEncoding (xmlParserCtxtPtr ctxt, - xmlParserErrors xmlerr, - const char *msg, - const xmlChar * str1, - const xmlChar * str2) LIBXML_ATTR_FORMAT(3,0); -#endif - /** * Input Streams. */ @@ -645,15 +635,6 @@ XMLPUBFUN void XMLCALL #endif /* LIBXML_LEGACY_ENABLED */ -#ifdef IN_LIBXML -/* - * internal only - */ -XMLPUBFUN void XMLCALL - xmlErrMemory (xmlParserCtxtPtr ctxt, - const char *extra); -#endif - #ifdef __cplusplus } #endif diff --git a/include/libxml/valid.h b/include/libxml/valid.h index 3eaf84ad..78771d44 100644 --- a/include/libxml/valid.h +++ b/include/libxml/valid.h @@ -58,21 +58,6 @@ typedef void (XMLCDECL *xmlValidityWarningFunc) (void *ctx, const char *msg, ...) LIBXML_ATTR_FORMAT(2,3); -#ifdef IN_LIBXML -/** - * XML_VCTXT_DTD_VALIDATED: - * - * Set after xmlValidateDtdFinal was called. - */ -#define XML_VCTXT_DTD_VALIDATED (1u << 0) -/** - * XML_VCTXT_USE_PCTXT: - * - * Set if the validation context is part of a parser context. - */ -#define XML_VCTXT_USE_PCTXT (1u << 1) -#endif - /* * xmlValidCtxt: * An xmlValidCtxt is used for error reporting when validating. diff --git a/include/libxml/xmlautomata.h b/include/libxml/xmlautomata.h index bf1b131c..c0ef44f1 100644 --- a/include/libxml/xmlautomata.h +++ b/include/libxml/xmlautomata.h @@ -11,11 +11,11 @@ #define __XML_AUTOMATA_H__ #include <libxml/xmlversion.h> -#include <libxml/tree.h> #ifdef LIBXML_REGEXP_ENABLED #ifdef LIBXML_AUTOMATA_ENABLED -#include <libxml/xmlregexp.h> + +#include <libxml/xmlstring.h> #ifdef __cplusplus extern "C" { @@ -131,7 +131,7 @@ XMLPUBFUN int XMLCALL int min, int max); -XMLPUBFUN xmlRegexpPtr XMLCALL +XMLPUBFUN struct _xmlRegexp * XMLCALL xmlAutomataCompile (xmlAutomataPtr am); XMLPUBFUN int XMLCALL xmlAutomataIsDeterminist (xmlAutomataPtr am); diff --git a/include/libxml/xmlerror.h b/include/libxml/xmlerror.h index ee95be9c..f92b1aee 100644 --- a/include/libxml/xmlerror.h +++ b/include/libxml/xmlerror.h @@ -912,35 +912,6 @@ XMLPUBFUN int XMLCALL xmlCopyError (xmlErrorPtr from, xmlErrorPtr to); -#ifdef IN_LIBXML -/* - * Internal callback reporting routine - */ -XMLPUBFUN void XMLCALL - __xmlRaiseError (xmlStructuredErrorFunc schannel, - xmlGenericErrorFunc channel, - void *data, - void *ctx, - void *node, - 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); -XMLPUBFUN void XMLCALL - __xmlSimpleError (int domain, - int code, - xmlNodePtr node, - const char *msg, - const char *extra) LIBXML_ATTR_FORMAT(4,0); -#endif #ifdef __cplusplus } #endif diff --git a/include/private/Makefile.am b/include/private/Makefile.am new file mode 100644 index 00000000..a1686980 --- /dev/null +++ b/include/private/Makefile.am @@ -0,0 +1,15 @@ +EXTRA_DIST = \ + buf.h \ + dict.h \ + enc.h \ + entities.h \ + error.h \ + html.h \ + io.h \ + parser.h \ + regexp.h \ + save.h \ + string.h \ + threads.h \ + tree.h \ + xzlib.h diff --git a/buf.h b/include/private/buf.h index b7bcf61f..12f725de 100644 --- a/buf.h +++ b/include/private/buf.h @@ -1,24 +1,8 @@ -/* - * Summary: Internal Interfaces for memory buffers in libxml2 - * Description: this module describes most of the new xmlBuf buffer - * entry points, those are private routines, with a - * few exceptions exported in tree.h. This was added - * in 2.9.0. - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_BUF_H__ -#define __XML_BUF_H__ +#ifndef XML_BUF_H_PRIVATE__ +#define XML_BUF_H_PRIVATE__ #include <libxml/tree.h> -#ifdef __cplusplus -extern "C" { -#endif - xmlBufPtr xmlBufCreate(void); xmlBufPtr xmlBufCreateSize(size_t size); xmlBufPtr xmlBufCreateStatic(void *mem, size_t size); @@ -60,8 +44,5 @@ 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); -#ifdef __cplusplus -} -#endif -#endif /* __XML_BUF_H__ */ +#endif /* XML_BUF_H_PRIVATE__ */ diff --git a/include/private/dict.h b/include/private/dict.h new file mode 100644 index 00000000..02b18f92 --- /dev/null +++ b/include/private/dict.h @@ -0,0 +1,7 @@ +#ifndef XML_DICT_H_PRIVATE__ +#define XML_DICT_H_PRIVATE__ + +int __xmlInitializeDict(void); +int __xmlRandom(void); + +#endif /* XML_DICT_H_PRIVATE__ */ diff --git a/include/private/enc.h b/include/private/enc.h new file mode 100644 index 00000000..4fd32342 --- /dev/null +++ b/include/private/enc.h @@ -0,0 +1,11 @@ +#ifndef XML_ENC_H_PRIVATE__ +#define XML_ENC_H_PRIVATE__ + +#include <libxml/encoding.h> +#include <libxml/tree.h> + +int xmlCharEncFirstLineInput(xmlParserInputBufferPtr input, int len); +int xmlCharEncInput(xmlParserInputBufferPtr input, int flush); +int xmlCharEncOutput(xmlOutputBufferPtr output, int init); + +#endif /* XML_ENC_H_PRIVATE__ */ diff --git a/include/private/entities.h b/include/private/entities.h new file mode 100644 index 00000000..9be17bb3 --- /dev/null +++ b/include/private/entities.h @@ -0,0 +1,9 @@ +#ifndef XML_ENTITIES_H_PRIVATE__ +#define XML_ENTITIES_H_PRIVATE__ + +#include <libxml/tree.h> +#include <libxml/xmlstring.h> + +xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input); + +#endif /* XML_ENTITIES_H_PRIVATE__ */ diff --git a/include/private/error.h b/include/private/error.h new file mode 100644 index 00000000..c76e0733 --- /dev/null +++ b/include/private/error.h @@ -0,0 +1,21 @@ +#ifndef XML_ERROR_H_PRIVATE__ +#define XML_ERROR_H_PRIVATE__ + +#include <libxml/xmlerror.h> +#include <libxml/xmlversion.h> + +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 +__xmlSimpleError(int domain, int code, xmlNodePtr node, + const char *msg, const char *extra) LIBXML_ATTR_FORMAT(4,0); +void +xmlGenericErrorDefaultFunc(void *ctx, const char *msg, + ...) LIBXML_ATTR_FORMAT(2,3); + +#endif /* XML_ERROR_H_PRIVATE__ */ diff --git a/include/private/html.h b/include/private/html.h new file mode 100644 index 00000000..8f77d338 --- /dev/null +++ b/include/private/html.h @@ -0,0 +1,13 @@ +#ifndef XML_HTML_H_PRIVATE__ +#define XML_HTML_H_PRIVATE__ + +#include <libxml/xmlversion.h> + +#ifdef LIBXML_HTML_ENABLED + +void __htmlParseContent(void *ctx); + +#endif /* LIBXML_HTML_ENABLED */ + +#endif /* XML_HTML_H_PRIVATE__ */ + diff --git a/include/private/io.h b/include/private/io.h new file mode 100644 index 00000000..d0994dbd --- /dev/null +++ b/include/private/io.h @@ -0,0 +1,18 @@ +#ifndef XML_IO_H_PRIVATE__ +#define XML_IO_H_PRIVATE__ + +#include <libxml/encoding.h> +#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); +int xmlInputReadCallbackNop(void *context, char *buffer, int len); + +#ifdef LIBXML_OUTPUT_ENABLED +xmlOutputBufferPtr +xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); +#endif + +#endif /* XML_IO_H_PRIVATE__ */ diff --git a/include/private/parser.h b/include/private/parser.h new file mode 100644 index 00000000..1bf9ee35 --- /dev/null +++ b/include/private/parser.h @@ -0,0 +1,25 @@ +#ifndef XML_PARSER_H_PRIVATE__ +#define XML_PARSER_H_PRIVATE__ + +#include <libxml/parser.h> +#include <libxml/xmlversion.h> + +/** + * XML_VCTXT_DTD_VALIDATED: + * + * Set after xmlValidateDtdFinal was called. + */ +#define XML_VCTXT_DTD_VALIDATED (1u << 0) +/** + * XML_VCTXT_USE_PCTXT: + * + * Set if the validation context is part of a parser context. + */ +#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); + +#endif /* XML_PARSER_H_PRIVATE__ */ diff --git a/include/private/regexp.h b/include/private/regexp.h new file mode 100644 index 00000000..3ffb378a --- /dev/null +++ b/include/private/regexp.h @@ -0,0 +1,8 @@ +#ifndef XML_REGEXP_H_PRIVATE__ +#define XML_REGEXP_H_PRIVATE__ + +#include <libxml/xmlautomata.h> + +void xmlAutomataSetFlags(xmlAutomataPtr am, int flags); + +#endif /* XML_REGEXP_H_PRIVATE__ */ diff --git a/include/private/save.h b/include/private/save.h new file mode 100644 index 00000000..ec970851 --- /dev/null +++ b/include/private/save.h @@ -0,0 +1,16 @@ +#ifndef XML_SAVE_H_PRIVATE__ +#define XML_SAVE_H_PRIVATE__ + +#include <libxml/tree.h> +#include <libxml/xmlversion.h> + +#ifdef LIBXML_OUTPUT_ENABLED + +void xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc, + xmlAttrPtr attr, const xmlChar * string); +void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); + +#endif /* LIBXML_OUTPUT_ENABLED */ + +#endif /* XML_SAVE_H_PRIVATE__ */ + diff --git a/include/private/string.h b/include/private/string.h new file mode 100644 index 00000000..0c4bf541 --- /dev/null +++ b/include/private/string.h @@ -0,0 +1,8 @@ +#ifndef XML_STRING_H_PRIVATE__ +#define XML_STRING_H_PRIVATE__ + +#include <libxml/xmlstring.h> + +xmlChar *xmlEscapeFormatString(xmlChar **msg); + +#endif /* XML_STRING_H_PRIVATE__ */ diff --git a/include/private/threads.h b/include/private/threads.h new file mode 100644 index 00000000..c054a6fb --- /dev/null +++ b/include/private/threads.h @@ -0,0 +1,8 @@ +#ifndef XML_THREADS_H_PRIVATE__ +#define XML_THREADS_H_PRIVATE__ + +void __xmlGlobalInitMutexLock(void); +void __xmlGlobalInitMutexUnlock(void); +void __xmlGlobalInitMutexDestroy(void); + +#endif /* XML_THREADS_H_PRIVATE__ */ diff --git a/include/private/tree.h b/include/private/tree.h new file mode 100644 index 00000000..8b7f65d4 --- /dev/null +++ b/include/private/tree.h @@ -0,0 +1,11 @@ +#ifndef XML_TREE_H_PRIVATE__ +#define XML_TREE_H_PRIVATE__ + +/* + * Internal variable indicating if a callback has been registered for + * node creation/destruction. It avoids spending a lot of time in locking + * function while checking if the callback exists. + */ +extern int __xmlRegisterCallbacks; + +#endif /* XML_TREE_H_PRIVATE__ */ diff --git a/xzlib.h b/include/private/xzlib.h index 7b1df15c..001854e5 100644 --- a/xzlib.h +++ b/include/private/xzlib.h @@ -9,6 +9,11 @@ #ifndef LIBXML2_XZLIB_H #define LIBXML2_XZLIB_H + +#include <libxml/xmlversion.h> + +#ifdef LIBXML_LZMA_ENABLED + typedef void *xzFile; /* opaque lzma file descriptor */ xzFile __libxml2_xzopen(const char *path, const char *mode); @@ -16,4 +21,7 @@ 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); + +#endif /* LIBXML_LZMA_ENABLED */ + #endif /* LIBXML2_XZLIB_H */ @@ -29,7 +29,6 @@ */ #include "config.h" #include <libxml/xmlversion.h> -#include <libxml/xmlstring.h> #ifndef SYSCONFDIR #define SYSCONFDIR "/etc" @@ -74,42 +73,6 @@ int vfprintf(FILE *, const char *, va_list); #define ATTRIBUTE_NO_SANITIZE(arg) #endif -/* - * Internal variable indicating if a callback has been registered for - * node creation/destruction. It avoids spending a lot of time in locking - * function while checking if the callback exists. - */ -extern int __xmlRegisterCallbacks; -/* - * internal error reporting routines, shared but not part of the API. - */ -void __xmlIOErr(int domain, int code, const char *extra); -void __xmlLoaderErr(void *ctx, const char *msg, const char *filename) LIBXML_ATTR_FORMAT(2,0); -#ifdef LIBXML_HTML_ENABLED -/* - * internal function of HTML parser needed for xmlParseInNodeContext - * but not part of the API - */ -void __htmlParseContent(void *ctx); -#endif - -/* - * internal global initialization critical section routines. - */ -void __xmlGlobalInitMutexLock(void); -void __xmlGlobalInitMutexUnlock(void); -void __xmlGlobalInitMutexDestroy(void); - -int __xmlInitializeDict(void); - -/* - * internal thread safe random function - */ -int __xmlRandom(void); - -XMLPUBFUN xmlChar * XMLCALL xmlEscapeFormatString(xmlChar **msg); -int xmlInputReadCallbackNop(void *context, char *buffer, int len); - #if !defined(PIC) && !defined(NOLIBTOOL) && !defined(LIBXML_STATIC) # define LIBXML_STATIC #endif @@ -59,6 +59,9 @@ #include <libxml/nanoftp.h> #include <libxml/globals.h> +#include "private/error.h" +#include "private/io.h" + /* #define DEBUG_FTP 1 */ #ifdef STANDALONE #ifndef DEBUG_FTP @@ -78,6 +78,9 @@ #include <libxml/globals.h> #include <libxml/uri.h> +#include "private/error.h" +#include "private/io.h" + /** * A couple portability macros */ @@ -72,8 +72,13 @@ #include <libxml/relaxng.h> #endif -#include "buf.h" -#include "enc.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/html.h" +#include "private/io.h" +#include "private/parser.h" +#include "private/threads.h" struct _xmlStartTag { const xmlChar *prefix; @@ -14704,7 +14709,6 @@ xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func) #include <libxml/xpath.h> #endif -extern void XMLCDECL xmlGenericErrorDefaultFunc(void *ctx, const char *msg, ...); static int xmlParserInitialized = 0; /** diff --git a/parserInternals.c b/parserInternals.c index c74fab9f..eb12e629 100644 --- a/parserInternals.c +++ b/parserInternals.c @@ -43,8 +43,11 @@ #define END(ctxt) ctxt->input->end #define VALID_CTXT(ctxt) (CUR(ctxt) <= END(ctxt)) -#include "buf.h" -#include "enc.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/io.h" +#include "private/parser.h" /* * Various global defaults for parsing @@ -34,6 +34,10 @@ #include <libxml/xmlregexp.h> #include <libxml/xmlschemastypes.h> +#include "private/error.h" +#include "private/regexp.h" +#include "private/string.h" + /* * The Relax-NG namespace */ @@ -2875,10 +2879,6 @@ xmlRelaxNGCleanupTypes(void) * * ************************************************************************/ -/* from automata.c but not exported */ -void xmlAutomataSetFlags(xmlAutomataPtr am, int flags); - - static int xmlRelaxNGTryCompile(xmlRelaxNGParserCtxtPtr ctxt, xmlRelaxNGDefinePtr def); diff --git a/save.h b/save.h deleted file mode 100644 index 192b6741..00000000 --- a/save.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Summary: Internal Interfaces for saving in libxml2 - * Description: this module describes a few interfaces which were - * added along with the API changes in 2.9.0 - * those are private routines at this point - * - * Copy: See Copyright for the status of this software. - * - * Author: Daniel Veillard - */ - -#ifndef __XML_SAVE_H__ -#define __XML_SAVE_H__ - -#include <libxml/tree.h> - -#ifdef __cplusplus -extern "C" { -#endif - -#ifdef LIBXML_OUTPUT_ENABLED -void xmlBufAttrSerializeTxtContent(xmlBufPtr buf, xmlDocPtr doc, - xmlAttrPtr attr, const xmlChar * string); -void xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table); -void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem); -void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr); -void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent); -#endif - -xmlChar *xmlEncodeAttributeEntities(xmlDocPtr doc, const xmlChar *input); - -#ifdef __cplusplus -} -#endif -#endif /* __XML_SAVE_H__ */ - diff --git a/schematron.c b/schematron.c index 68a4c622..5f71f060 100644 --- a/schematron.c +++ b/schematron.c @@ -34,6 +34,8 @@ #include <libxml/pattern.h> #include <libxml/schematron.h> +#include "private/error.h" + #define SCHEMATRON_PARSE_OPTIONS XML_PARSE_NOENT #define SCT_OLD_NS BAD_CAST "http://www.ascc.net/xml/schematron" @@ -15330,43 +15330,6 @@ test_xmlCurrentChar(void) { static int -test_xmlErrMemory(void) { - int test_ret = 0; - - int mem_base; - xmlParserCtxtPtr ctxt; /* an XML parser context */ - int n_ctxt; - char * extra; /* extra information */ - int n_extra; - - for (n_ctxt = 0;n_ctxt < gen_nb_xmlParserCtxtPtr;n_ctxt++) { - for (n_extra = 0;n_extra < gen_nb_const_char_ptr;n_extra++) { - mem_base = xmlMemBlocks(); - ctxt = gen_xmlParserCtxtPtr(n_ctxt, 0); - extra = gen_const_char_ptr(n_extra, 1); - - xmlErrMemory(ctxt, (const char *)extra); - call_tests++; - des_xmlParserCtxtPtr(n_ctxt, ctxt, 0); - des_const_char_ptr(n_extra, (const char *)extra, 1); - xmlResetLastError(); - if (mem_base != xmlMemBlocks()) { - printf("Leak of %d blocks found in xmlErrMemory", - xmlMemBlocks() - mem_base); - test_ret++; - printf(" %d", n_ctxt); - printf(" %d", n_extra); - printf("\n"); - } - } - } - function_tests++; - - return(test_ret); -} - - -static int test_xmlIsLetter(void) { int test_ret = 0; @@ -16051,7 +16014,7 @@ static int test_parserInternals(void) { int test_ret = 0; - if (quiet == 0) printf("Testing parserInternals : 31 of 88 functions ...\n"); + if (quiet == 0) printf("Testing parserInternals : 30 of 87 functions ...\n"); test_ret += test_inputPop(); test_ret += test_inputPush(); test_ret += test_namePop(); @@ -16066,7 +16029,6 @@ test_parserInternals(void) { test_ret += test_xmlCreateMemoryParserCtxt(); test_ret += test_xmlCreateURLParserCtxt(); test_ret += test_xmlCurrentChar(); - test_ret += test_xmlErrMemory(); test_ret += test_xmlIsLetter(); test_ret += test_xmlNewEntityInputStream(); test_ret += test_xmlNewInputFromFile(); @@ -7,11 +7,10 @@ #include <stdio.h> #include <string.h> +#include <libxml/tree.h> #include <libxml/parser.h> #include <libxml/parserInternals.h> -#include "buf.h" - int lastError; static void errorHandler(void *unused, xmlErrorPtr err) { @@ -35,6 +35,9 @@ #include <note.h> #endif +#include "private/dict.h" +#include "private/threads.h" + /* #define DEBUG_THREADS */ #ifdef HAVE_PTHREAD_H @@ -44,8 +44,10 @@ #include <libxml/debugXML.h> #endif -#include "buf.h" -#include "save.h" +#include "private/buf.h" +#include "private/entities.h" +#include "private/error.h" +#include "private/tree.h" int __xmlRegisterCallbacks = 0; @@ -19,6 +19,8 @@ #include <libxml/globals.h> #include <libxml/xmlerror.h> +#include "private/error.h" + /** * MAX_URI_LENGTH: * @@ -23,6 +23,9 @@ #include <libxml/list.h> #include <libxml/globals.h> +#include "private/error.h" +#include "private/parser.h" + static xmlElementPtr xmlGetDtdElementDesc2(xmlDtdPtr dtd, const xmlChar *name, int create); /* #define DEBUG_VALID_ALGO */ @@ -27,7 +27,8 @@ #ifdef LIBXML_XINCLUDE_ENABLED #include <libxml/xinclude.h> -#include "buf.h" +#include "private/buf.h" +#include "private/error.h" #define XINCLUDE_MAX_DEPTH 40 @@ -66,8 +66,11 @@ #endif #include <libxml/globals.h> -#include "buf.h" -#include "enc.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/io.h" +#include "private/parser.h" /* #define VERBOSE_FAILURE */ /* #define DEBUG_EXTERNAL_ENTITIES */ @@ -111,9 +114,6 @@ typedef struct _xmlOutputCallback { static xmlOutputCallback xmlOutputCallbackTable[MAX_OUTPUT_CALLBACK]; static int xmlOutputCallbackNr = 0; static int xmlOutputCallbackInitialized = 0; - -xmlOutputBufferPtr -xmlAllocOutputBufferInternal(xmlCharEncodingHandlerPtr encoder); #endif /* LIBXML_OUTPUT_ENABLED */ /************************************************************************ @@ -1266,7 +1266,7 @@ xmlGzfileClose (void * context) { * I/O for compressed file accesses * * * ************************************************************************/ -#include "xzlib.h" +#include "private/xzlib.h" /** * xmlXzfileMatch: * @filename: the URI for matching diff --git a/xmlmodule.c b/xmlmodule.c index 44eba066..8d6ea8dc 100644 --- a/xmlmodule.c +++ b/xmlmodule.c @@ -22,6 +22,8 @@ #include <libxml/xmlmodule.h> #include <libxml/globals.h> +#include "private/error.h" + #ifdef LIBXML_MODULES_ENABLED struct _xmlModule { diff --git a/xmlreader.c b/xmlreader.c index b3299ced..383f07a6 100644 --- a/xmlreader.c +++ b/xmlreader.c @@ -39,7 +39,8 @@ #include <libxml/pattern.h> #endif -#include "buf.h" +#include "private/buf.h" +#include "private/tree.h" #define MAX_ERR_MSG_SIZE 64000 diff --git a/xmlregexp.c b/xmlregexp.c index a2a36c49..56cd8629 100644 --- a/xmlregexp.c +++ b/xmlregexp.c @@ -31,6 +31,9 @@ #include <libxml/xmlautomata.h> #include <libxml/xmlunicode.h> +#include "private/error.h" +#include "private/regexp.h" + #ifndef SIZE_MAX #define SIZE_MAX ((size_t) -1) #endif @@ -361,8 +364,6 @@ static int xmlRegCheckCharacter(xmlRegAtomPtr atom, int codepoint); static int xmlRegCheckCharacterRange(xmlRegAtomType type, int codepoint, int neg, int start, int end, const xmlChar *blockName); -void xmlAutomataSetFlags(xmlAutomataPtr am, int flags); - /************************************************************************ * * * Regexp memory error handler * @@ -19,9 +19,10 @@ #include <libxml/HTMLtree.h> -#include "buf.h" -#include "enc.h" -#include "save.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/save.h" /************************************************************************ * * @@ -463,7 +464,7 @@ xmlAttrSerializeContent(xmlOutputBufferPtr buf, xmlAttrPtr attr) * * This will dump the content of the notation table as an XML DTD definition */ -void +static void xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) { xmlBufferPtr buffer; @@ -487,7 +488,7 @@ xmlBufDumpNotationTable(xmlBufPtr buf, xmlNotationTablePtr table) { * This will dump the content of the element declaration as an XML * DTD definition */ -void +static void xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) { xmlBufferPtr buffer; @@ -511,7 +512,7 @@ xmlBufDumpElementDecl(xmlBufPtr buf, xmlElementPtr elem) { * This will dump the content of the attribute declaration as an XML * DTD definition */ -void +static void xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) { xmlBufferPtr buffer; @@ -534,7 +535,7 @@ xmlBufDumpAttributeDecl(xmlBufPtr buf, xmlAttributePtr attr) { * * This will dump the content of the entity table as an XML DTD definition */ -void +static void xmlBufDumpEntityDecl(xmlBufPtr buf, xmlEntityPtr ent) { xmlBufferPtr buffer; @@ -595,7 +596,6 @@ static void xhtmlNodeDumpOutput(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); #endif static void xmlNodeDumpOutputInternal(xmlSaveCtxtPtr ctxt, xmlNodePtr cur); -void xmlNsListDumpOutput(xmlOutputBufferPtr buf, xmlNsPtr cur); static int xmlDocContentDumpOutput(xmlSaveCtxtPtr ctxt, xmlDocPtr cur); /** diff --git a/xmlschemas.c b/xmlschemas.c index ccbd3ea3..ade10f78 100644 --- a/xmlschemas.c +++ b/xmlschemas.c @@ -76,6 +76,9 @@ #include <libxml/xmlreader.h> #endif +#include "private/error.h" +#include "private/string.h" + /* #define DEBUG 1 */ /* #define DEBUG_CONTENT 1 */ diff --git a/xmlschemastypes.c b/xmlschemastypes.c index 26c033d4..79825be0 100644 --- a/xmlschemastypes.c +++ b/xmlschemastypes.c @@ -33,6 +33,8 @@ #include <libxml/schemasInternals.h> #include <libxml/xmlschemastypes.h> +#include "private/error.h" + #define DEBUG #ifndef LIBXML_XPATH_ENABLED diff --git a/xmlstring.c b/xmlstring.c index 46301c3b..2bd7e6a6 100644 --- a/xmlstring.c +++ b/xmlstring.c @@ -23,6 +23,9 @@ #include <libxml/parserInternals.h> #include <libxml/xmlstring.h> +#include "private/parser.h" +#include "private/string.h" + /************************************************************************ * * * Commodity functions to handle xmlChars * diff --git a/xmlwriter.c b/xmlwriter.c index 85c19558..1cf82906 100644 --- a/xmlwriter.c +++ b/xmlwriter.c @@ -21,9 +21,10 @@ #include <libxml/xmlwriter.h> -#include "buf.h" -#include "enc.h" -#include "save.h" +#include "private/buf.h" +#include "private/enc.h" +#include "private/error.h" +#include "private/save.h" #define B64LINELEN 72 #define B64CRLF "\r\n" @@ -49,7 +49,8 @@ #include <libxml/pattern.h> #endif -#include "buf.h" +#include "private/buf.h" +#include "private/error.h" #ifdef LIBXML_PATTERN_ENABLED #define XPATH_STREAMING @@ -52,6 +52,8 @@ #endif #endif +#include "private/error.h" + #define TODO \ xmlGenericError(xmlGenericErrorContext, \ "Unimplemented block at %s:%d\n", \ @@ -33,7 +33,7 @@ #include <lzma.h> #endif -#include "xzlib.h" +#include "private/xzlib.h" #include <libxml/xmlmemory.h> /* values for xz_state how */ |