From b0fc67aa2204f381458c190d33614646a2427de1 Mon Sep 17 00:00:00 2001 From: Nick Wellnhofer Date: Sat, 15 Jun 2024 22:53:55 +0200 Subject: [PATCH] build: Remove --with-tree configuration option This option would allow for a smaller, but mostly useless minimal build. But it complicates the symbol availability logic in an insane way and requires specialized tools like our custom C parser in doc/apibuild.py. See #717. --- CMakeLists.txt | 3 +- configure.ac | 23 ---------- debugXML.c | 6 --- doc/libxml2-api.xml | 39 +---------------- entities.c | 2 - example/io2.c | 4 +- example/tree1.c | 8 ---- example/tree2.c | 4 +- gentest.py | 9 ---- include/libxml/entities.h | 2 - include/libxml/meson.build | 1 - include/libxml/tree.h | 45 -------------------- include/libxml/valid.h | 8 ---- include/libxml/xmlversion.h.in | 4 +- meson.build | 15 ------- meson_options.txt | 7 --- parser.c | 4 -- testapi.c | 78 ---------------------------------- tree.c | 60 +------------------------- valid.c | 8 ---- xmllint.c | 19 --------- 21 files changed, 8 insertions(+), 341 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4dd4703e..29cfec17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -51,7 +51,6 @@ option(LIBXML2_WITH_TESTS "Build tests" ON) option(LIBXML2_WITH_THREADS "Add multithread support" ON) option(LIBXML2_WITH_THREAD_ALLOC "Add per-thread memory" OFF) option(LIBXML2_WITH_TLS "Enable thread-local storage" OFF) -option(LIBXML2_WITH_TREE "Add the DOM like tree manipulation APIs" ON) set(LIBXML2_WITH_UNICODE ON) option(LIBXML2_WITH_VALID "Add the DTD validation support" ON) option(LIBXML2_WITH_WRITER "Add the xmlWriter saving interface" ON) @@ -70,7 +69,7 @@ if(LIBXML2_WITH_PYTHON) CACHE PATH "Python bindings install directory") endif() -foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_TREE WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB) +foreach(VARIABLE IN ITEMS WITH_AUTOMATA WITH_C14N WITH_CATALOG WITH_DEBUG WITH_EXPR WITH_HTML WITH_HTTP WITH_ICONV WITH_ICU WITH_ISO8859X WITH_LEGACY WITH_LZMA WITH_MODULES WITH_OUTPUT WITH_PATTERN WITH_PUSH WITH_READER WITH_REGEXPS WITH_SAX1 WITH_SCHEMAS WITH_SCHEMATRON WITH_THREADS WITH_THREAD_ALLOC WITH_UNICODE WITH_VALID WITH_WRITER WITH_XINCLUDE WITH_XPATH WITH_XPTR WITH_ZLIB) if(LIBXML2_${VARIABLE}) set(${VARIABLE} 1) else() diff --git a/configure.ac b/configure.ac index e92a0c3f..857c2f4d 100644 --- a/configure.ac +++ b/configure.ac @@ -109,8 +109,6 @@ AC_ARG_WITH(threads, [ --with-threads multithreading support (on)]) AC_ARG_WITH(thread-alloc, [ --with-thread-alloc per-thread malloc hooks (off)]) -AC_ARG_WITH(tree, -[ --with-tree DOM like tree manipulation APIs (on)]) AC_ARG_WITH(valid, [ --with-valid DTD validation support (on)]) AC_ARG_WITH(writer, @@ -175,10 +173,6 @@ if test "$with_schematron" = "yes"; then echo WARNING: --with-schematron overrides --without-pattern fi with_pattern=yes - if test "$with_tree" = "no"; then - echo WARNING: --with-schematron overrides --without-tree - fi - with_tree=yes if test "$with_xpath" = "no"; then echo WARNING: --with-schematron overrides --without-xpath fi @@ -189,10 +183,6 @@ if test "$with_reader" = "yes"; then echo WARNING: --with-reader overrides --without-push fi with_push=yes - if test "$with_tree" = "no"; then - echo WARNING: --with-reader overrides --without-tree - fi - with_tree=yes fi if test "$with_writer" = "yes"; then if test "$with_output" = "no"; then @@ -243,7 +233,6 @@ if test "$with_minimum" = "yes"; then test "$with_schematron" = "" && with_schematron=no test "$with_threads" = "" && with_threads=no test "$with_thread_alloc" = "" && with_thread_alloc=no - test "$with_tree" = "" && with_tree=no test "$with_valid" = "" && with_valid=no test "$with_writer" = "" && with_writer=no test "$with_xinclude" = "" && with_xinclude=no @@ -270,10 +259,6 @@ else if test "$with_regexps" = "no"; then with_schemas=no fi - if test "$with_tree" = "no"; then - with_reader=no - with_schematron=no - fi if test "$with_xpath" = "no"; then with_c14n=no with_schematron=no @@ -504,14 +489,6 @@ dnl dnl Simple API modules dnl -if test "$with_tree" = "no" ; then - echo Disabling DOM like tree manipulation APIs - WITH_TREE=0 -else - WITH_TREE=1 -fi -AC_SUBST(WITH_TREE) - if test "$with_http" != "yes" ; then WITH_HTTP=0 else diff --git a/debugXML.c b/debugXML.c index 90563984..9855a2db 100644 --- a/debugXML.c +++ b/debugXML.c @@ -240,12 +240,10 @@ xmlCtxtCheckName(xmlDebugCtxtPtr ctxt, const xmlChar * name) xmlDebugErr(ctxt, XML_CHECK_NO_NAME, "Name is NULL"); return; } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) if (xmlValidateName(name, 0)) { xmlDebugErr3(ctxt, XML_CHECK_NOT_NCNAME, "Name is not an NCName '%s'", (const char *) name); } -#endif if ((ctxt->dict != NULL) && (!xmlDictOwns(ctxt->dict, name)) && ((ctxt->doc == NULL) || @@ -2036,7 +2034,6 @@ xmlShellBase(xmlShellCtxtPtr ctxt, return (0); } -#ifdef LIBXML_TREE_ENABLED /** * xmlShellSetBase: * @ctxt: the shell context @@ -2057,7 +2054,6 @@ xmlShellSetBase(xmlShellCtxtPtr ctxt ATTRIBUTE_UNUSED, xmlNodeSetBase(node, (xmlChar*) arg); return (0); } -#endif #ifdef LIBXML_XPATH_ENABLED /** @@ -3025,10 +3021,8 @@ xmlShell(xmlDocPtr doc, const char *filename, xmlShellReadlineFunc input, xmlXPathFreeObject(list); } #endif /* LIBXML_XPATH_ENABLED */ -#ifdef LIBXML_TREE_ENABLED } else if (!strcmp(command, "setbase")) { xmlShellSetBase(ctxt, arg, ctxt->node, NULL); -#endif } else if ((!strcmp(command, "ls")) || (!strcmp(command, "dir"))) { int dir = (!strcmp(command, "dir")); diff --git a/doc/libxml2-api.xml b/doc/libxml2-api.xml index 6ee2f7b0..482ec938 100644 --- a/doc/libxml2-api.xml +++ b/doc/libxml2-api.xml @@ -3975,7 +3975,7 @@ Whether the thread support is configured in - Whether the DOM like tree manipulation API support is configured in + Always enabled since 2.14.0 Whether the Unicode related interfaces are compiled in @@ -8163,7 +8163,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) Unlinks @cur and inserts it as previous sibling before @next. Unlike xmlAddChild this function does not merge text nodes. If @cur is an attribute node, it is inserted before attribute @next. If the attribute list contains an attribute with a name matching @cur, the old attribute is destroyed. See the notes in xmlAddChild. @@ -8823,7 +8822,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Count the number of child nodes which are elements. Note that entity references are not expanded. @@ -8883,7 +8881,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Build a copy of an attribute table. @@ -8902,7 +8899,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Copy a document. If recursive, the content tree will be copied too as well as DTD, namespaces and entities. @@ -8915,7 +8911,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Copy a DTD. @@ -8926,19 +8921,16 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Build a copy of an element table. - defined(LIBXML_TREE_ENABLED) Build a copy of an entity table. - defined(LIBXML_TREE_ENABLED) Copy an enumeration attribute node (recursive). @@ -8971,7 +8963,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Build a copy of a notation table. @@ -9486,7 +9477,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) Set the root element of the document (doc->children is a list containing possibly comments, PIs, etc ...). @root must be an element node. It is unlinked before insertion. @@ -9758,7 +9748,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Find the first child node which is an element. Note that entity references are not expanded. @@ -10098,20 +10087,17 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) Build a structure based Path for the given node - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Find all in-scope namespaces of a node. Use xmlGetNsListSafe for better error reporting. - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Find all in-scope namespaces of a node. @out returns a NULL terminated array of namespace pointers that must be freed by the caller. Available since 2.13.0. @@ -10675,7 +10661,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Find the last child node which is an element. Note that entity references are not expanded. @@ -11206,7 +11191,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Create a new child element and append it to a parent element. If @ns is NULL, the newly created element inherits the namespace of the parent. If provided, @content is expected to be a valid XML attribute value possibly containing character and entity references. Text and entity reference node will be added to the child element, see xmlNewDocNode. @@ -11238,7 +11222,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Create a document fragment node. @@ -11274,7 +11257,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Create an element node. If provided, @value should be a raw, unescaped string. @@ -11401,7 +11383,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Create an attribute node. If provided, @value should be a raw, unescaped string. If @node is provided, the created attribute will be appended without checking for duplicate names. It is an error if @node is not an element. @@ -11436,7 +11417,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Create a new child element and append it to a parent element. If @ns is NULL, the newly created element inherits the namespace of the parent. If @content is provided, a text node will be added to the child element, see xmlNewDocRawNode. @@ -11516,7 +11496,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Find the closest following sibling which is a element. Note that entity references are not expanded. @@ -11610,7 +11589,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Serializes attribute children (text and entity reference nodes) into a string. An empty list produces an empty string. If @inLine is true, entity references will be substituted. Otherwise, entity references will be kept and special characters like '&' will be escaped. @@ -11625,7 +11603,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) Set (or reset) the base URI of a node, i.e. the value of the xml:base attribute. @@ -11638,7 +11615,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) See xmlNodeSetContent. @@ -11646,21 +11622,18 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Set the language of a node, i.e. the values of the xml:lang attribute. - defined(LIBXML_TREE_ENABLED) Set (or reset) the name of a node. - defined(LIBXML_TREE_ENABLED) Set (or reset) the space preserving behaviour of a node, i.e. the value of the xml:space attribute. @@ -12437,7 +12410,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) Find the closest preceding sibling which is a element. Note that entity references are not expanded. @@ -12633,7 +12605,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) This function checks that all the namespaces declared within the given tree are properly declared. This is needed for example after Copy or Cut and then paste operations. The subtree may still hold pointers to namespace declarations outside the subtree or invalid/masked. As much as possible the function try to reuse the existing namespaces found in the new environment. If not possible the new namespaces are redeclared on @tree at the top of the given subtree. @@ -13010,7 +12981,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) Unlink the old node. If @cur is provided, it is unlinked and inserted in place of @old. It is an error if @old has no parent. Unlike xmlAddChild, this function doesn't merge text nodes or delete duplicate attributes. See the notes in xmlAddChild. @@ -14115,7 +14085,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) Set (or reset) an attribute carried by a node. The ns structure must be in scope, this is not checked @@ -14124,7 +14093,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) Set (or reset) an attribute carried by a node. If @name has a prefix, then the corresponding namespace-binding will be used, if in scope; it is an error it there's no such ns-binding for the prefix in scope. @@ -16843,7 +16811,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Remove an attribute carried by a node. @@ -16851,7 +16818,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Remove an attribute carried by a node. This handles only attributes in no namespace. @@ -16968,14 +16934,12 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Check that a value conforms to the lexical space of NMToken - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Check that a value conforms to the lexical space of Name @@ -17077,7 +17041,6 @@ Could we use @subtypes for this?'/> - defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) Check that a value conforms to the lexical space of QName diff --git a/entities.c b/entities.c index f7792a81..1005d783 100644 --- a/entities.c +++ b/entities.c @@ -850,7 +850,6 @@ xmlFreeEntitiesTable(xmlEntitiesTablePtr table) { xmlHashFree(table, xmlFreeEntityWrapper); } -#ifdef LIBXML_TREE_ENABLED /** * xmlCopyEntity: * @ent: An entity @@ -920,7 +919,6 @@ xmlEntitiesTablePtr xmlCopyEntitiesTable(xmlEntitiesTablePtr table) { return(xmlHashCopySafe(table, xmlCopyEntity, xmlFreeEntityWrapper)); } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_OUTPUT_ENABLED diff --git a/example/io2.c b/example/io2.c index 98e1a503..29149e1c 100644 --- a/example/io2.c +++ b/example/io2.c @@ -11,7 +11,7 @@ #include -#if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#if defined(LIBXML_OUTPUT_ENABLED) int main(void) { @@ -52,7 +52,7 @@ int main(void) { fprintf(stderr, - "library not configured with tree and output support\n"); + "library not configured with output support\n"); return (0); } #endif diff --git a/example/tree1.c b/example/tree1.c index 28fc1b70..cbbb0ae7 100644 --- a/example/tree1.c +++ b/example/tree1.c @@ -13,8 +13,6 @@ #include #include -#ifdef LIBXML_TREE_ENABLED - /* *To compile this file using gcc you can type *gcc `xml2-config --cflags --libs` -o xmlexample libxml2-example.c @@ -80,9 +78,3 @@ main(int argc, char **argv) return 0; } -#else -int main(void) { - fprintf(stderr, "Tree support not compiled in\n"); - return 0; -} -#endif diff --git a/example/tree2.c b/example/tree2.c index ef137af6..3f4810ce 100644 --- a/example/tree2.c +++ b/example/tree2.c @@ -12,7 +12,7 @@ #include #include -#if defined(LIBXML_TREE_ENABLED) && defined(LIBXML_OUTPUT_ENABLED) +#if defined(LIBXML_OUTPUT_ENABLED) /* *To compile this file using gcc you can type @@ -101,7 +101,7 @@ main(int argc, char **argv) } #else int main(void) { - fprintf(stderr, "tree support not compiled in\n"); + fprintf(stderr, "output support not compiled in\n"); return(0); } #endif diff --git a/gentest.py b/gentest.py index 482d6830..2709b8f0 100755 --- a/gentest.py +++ b/gentest.py @@ -79,15 +79,6 @@ function_defines = { "xmlAttrSerializeTxtContent": "LIBXML_OUTPUT_ENABLED", "xmlSAXParseFile": "LIBXML_SAX1_ENABLED", "xmlSAXParseEntity": "LIBXML_SAX1_ENABLED", - "xmlNewTextChild": "LIBXML_TREE_ENABLED", - "xmlNewDocRawNode": "LIBXML_TREE_ENABLED", - "xmlNewProp": "LIBXML_TREE_ENABLED", - "xmlReconciliateNs": "LIBXML_TREE_ENABLED", - "xmlValidateNCName": "LIBXML_TREE_ENABLED", - "xmlValidateNMToken": "LIBXML_TREE_ENABLED", - "xmlValidateName": "LIBXML_TREE_ENABLED", - "xmlNewChild": "LIBXML_TREE_ENABLED", - "xmlValidateQName": "LIBXML_TREE_ENABLED", "xmlSprintfElementContent": "LIBXML_OUTPUT_ENABLED", "xmlValidGetPotentialChildren" : "LIBXML_VALID_ENABLED", "xmlValidGetValidElements" : "LIBXML_VALID_ENABLED", diff --git a/include/libxml/entities.h b/include/libxml/entities.h index 26a8bc42..d40de269 100644 --- a/include/libxml/entities.h +++ b/include/libxml/entities.h @@ -137,10 +137,8 @@ XMLPUBFUN xmlChar * const xmlChar *input); XMLPUBFUN xmlEntitiesTablePtr xmlCreateEntitiesTable (void); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlEntitiesTablePtr xmlCopyEntitiesTable (xmlEntitiesTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void xmlFreeEntitiesTable (xmlEntitiesTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED diff --git a/include/libxml/meson.build b/include/libxml/meson.build index a3c37a74..59f8fa15 100644 --- a/include/libxml/meson.build +++ b/include/libxml/meson.build @@ -26,7 +26,6 @@ xmlversion_h.set10('WITH_SCHEMAS', want_schemas) xmlversion_h.set10('WITH_SCHEMATRON', want_schematron) xmlversion_h.set10('WITH_THREADS', threads_dep.found()) xmlversion_h.set10('WITH_THREAD_ALLOC', want_thread_alloc) -xmlversion_h.set10('WITH_TREE', want_tree) xmlversion_h.set10('WITH_VALID', want_valid) xmlversion_h.set10('WITH_WRITER', want_writer) xmlversion_h.set10('WITH_XINCLUDE', want_xinclude) diff --git a/include/libxml/tree.h b/include/libxml/tree.h index 409edcb6..7ee8960a 100644 --- a/include/libxml/tree.h +++ b/include/libxml/tree.h @@ -707,7 +707,6 @@ XMLPUBFUN int xmlValidateNCName (const xmlChar *value, int space); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN int xmlValidateQName (const xmlChar *value, int space); @@ -717,7 +716,6 @@ XMLPUBFUN int XMLPUBFUN int xmlValidateNMToken (const xmlChar *value, int space); -#endif XMLPUBFUN xmlChar * xmlBuildQName (const xmlChar *ncname, @@ -827,13 +825,10 @@ XMLPUBFUN xmlAttrPtr xmlNewDocProp (xmlDocPtr doc, const xmlChar *name, const xmlChar *value); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlAttrPtr xmlNewProp (xmlNodePtr node, const xmlChar *name, const xmlChar *value); -#endif XMLPUBFUN xmlAttrPtr xmlNewNsProp (xmlNodePtr node, xmlNsPtr ns, @@ -854,15 +849,11 @@ XMLPUBFUN xmlAttrPtr XMLPUBFUN xmlAttrPtr xmlCopyPropList (xmlNodePtr target, xmlAttrPtr cur); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlDtdPtr xmlCopyDtd (xmlDtdPtr dtd); -#endif /* LIBXML_TREE_ENABLED */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlDocPtr xmlCopyDoc (xmlDocPtr doc, int recursive); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ /* * Creating new nodes. */ @@ -882,13 +873,11 @@ XMLPUBFUN xmlNodePtr XMLPUBFUN xmlNodePtr xmlNewNodeEatName (xmlNsPtr ns, xmlChar *name); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN xmlNodePtr xmlNewChild (xmlNodePtr parent, xmlNsPtr ns, const xmlChar *name, const xmlChar *content); -#endif XMLPUBFUN xmlNodePtr xmlNewDocText (const xmlDoc *doc, const xmlChar *content); @@ -935,7 +924,6 @@ XMLPUBFUN xmlNodePtr xmlNodePtr node); XMLPUBFUN xmlNodePtr xmlCopyNodeList (xmlNodePtr node); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlNodePtr xmlNewTextChild (xmlNodePtr parent, xmlNsPtr ns, @@ -948,17 +936,14 @@ XMLPUBFUN xmlNodePtr const xmlChar *content); XMLPUBFUN xmlNodePtr xmlNewDocFragment (xmlDocPtr doc); -#endif /* LIBXML_TREE_ENABLED */ /* * Navigating. */ XMLPUBFUN long xmlGetLineNo (const xmlNode *node); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) XMLPUBFUN xmlChar * xmlGetNodePath (const xmlNode *node); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) */ XMLPUBFUN xmlNodePtr xmlDocGetRootElement (const xmlDoc *doc); XMLPUBFUN xmlNodePtr @@ -971,33 +956,24 @@ XMLPUBFUN int /* * Changing the structure. */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) XMLPUBFUN xmlNodePtr xmlDocSetRootElement (xmlDocPtr doc, xmlNodePtr root); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN void xmlNodeSetName (xmlNodePtr cur, const xmlChar *name); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN xmlNodePtr xmlAddChild (xmlNodePtr parent, xmlNodePtr cur); XMLPUBFUN xmlNodePtr xmlAddChildList (xmlNodePtr parent, xmlNodePtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) XMLPUBFUN xmlNodePtr xmlReplaceNode (xmlNodePtr old, xmlNodePtr cur); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) XMLPUBFUN xmlNodePtr xmlAddPrevSibling (xmlNodePtr cur, xmlNodePtr elem); -#endif /* LIBXML_TREE_ENABLED || LIBXML_HTML_ENABLED || LIBXML_SCHEMAS_ENABLED */ XMLPUBFUN xmlNodePtr xmlAddSibling (xmlNodePtr cur, xmlNodePtr elem); @@ -1034,8 +1010,6 @@ XMLPUBFUN xmlNsPtr xmlSearchNsByHref (xmlDocPtr doc, xmlNodePtr node, const xmlChar *href); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN int xmlGetNsListSafe (const xmlDoc *doc, const xmlNode *node, @@ -1043,7 +1017,6 @@ XMLPUBFUN int XMLPUBFUN xmlNsPtr * xmlGetNsList (const xmlDoc *doc, const xmlNode *node); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) */ XMLPUBFUN void xmlSetNs (xmlNodePtr node, @@ -1056,8 +1029,6 @@ XMLPUBFUN xmlNsPtr /* * Changing the content. */ -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) XMLPUBFUN xmlAttrPtr xmlSetProp (xmlNodePtr node, const xmlChar *name, @@ -1067,8 +1038,6 @@ XMLPUBFUN xmlAttrPtr xmlNsPtr ns, const xmlChar *name, const xmlChar *value); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) */ XMLPUBFUN int xmlNodeGetAttrValue (const xmlNode *node, const xmlChar *name, @@ -1102,21 +1071,17 @@ XMLPUBFUN xmlChar * xmlNodeListGetString (xmlDocPtr doc, const xmlNode *list, int inLine); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlChar * xmlNodeListGetRawString (const xmlDoc *doc, const xmlNode *list, int inLine); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN int xmlNodeSetContent (xmlNodePtr cur, const xmlChar *content); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN int xmlNodeSetContentLen (xmlNodePtr cur, const xmlChar *content, int len); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN int xmlNodeAddContent (xmlNodePtr cur, const xmlChar *content); @@ -1138,14 +1103,12 @@ XMLPUBFUN xmlChar * xmlNodeGetLang (const xmlNode *cur); XMLPUBFUN int xmlNodeGetSpacePreserve (const xmlNode *cur); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN int xmlNodeSetLang (xmlNodePtr cur, const xmlChar *lang); XMLPUBFUN int xmlNodeSetSpacePreserve (xmlNodePtr cur, int val); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN int xmlNodeGetBaseSafe (const xmlDoc *doc, const xmlNode *cur, @@ -1153,18 +1116,15 @@ XMLPUBFUN int XMLPUBFUN xmlChar * xmlNodeGetBase (const xmlDoc *doc, const xmlNode *cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) XMLPUBFUN int xmlNodeSetBase (xmlNodePtr cur, const xmlChar *uri); -#endif /* * Removing content. */ XMLPUBFUN int xmlRemoveProp (xmlAttrPtr cur); -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) XMLPUBFUN int xmlUnsetNsProp (xmlNodePtr node, xmlNsPtr ns, @@ -1172,7 +1132,6 @@ XMLPUBFUN int XMLPUBFUN int xmlUnsetProp (xmlNodePtr node, const xmlChar *name); -#endif /* defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) */ /* * Internal, don't use. @@ -1194,14 +1153,12 @@ XMLPUBFUN void xmlAttrSerializeTxtContent(xmlBufferPtr buf, const xmlChar *string); #endif /* LIBXML_OUTPUT_ENABLED */ -#ifdef LIBXML_TREE_ENABLED /* * Namespace handling. */ XMLPUBFUN int xmlReconciliateNs (xmlDocPtr doc, xmlNodePtr tree); -#endif #ifdef LIBXML_OUTPUT_ENABLED /* @@ -1342,7 +1299,6 @@ XMLPUBFUN int int deep, int options); -#ifdef LIBXML_TREE_ENABLED /* * 5 interfaces from DOM ElementTraversal, but different in entities * traversal. @@ -1357,7 +1313,6 @@ XMLPUBFUN xmlNodePtr xmlLastElementChild (xmlNodePtr parent); XMLPUBFUN xmlNodePtr xmlPreviousElementSibling (xmlNodePtr node); -#endif XML_DEPRECATED XMLPUBFUN xmlRegisterNodeFunc diff --git a/include/libxml/valid.h b/include/libxml/valid.h index b9db720e..bcba213f 100644 --- a/include/libxml/valid.h +++ b/include/libxml/valid.h @@ -143,10 +143,8 @@ XMLPUBFUN xmlNotationPtr const xmlChar *name, const xmlChar *PublicID, const xmlChar *SystemID); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlNotationTablePtr xmlCopyNotationTable (xmlNotationTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void xmlFreeNotationTable (xmlNotationTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED @@ -200,10 +198,8 @@ XMLPUBFUN xmlElementPtr const xmlChar *name, xmlElementTypeVal type, xmlElementContentPtr content); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlElementTablePtr xmlCopyElementTable (xmlElementTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void xmlFreeElementTable (xmlElementTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED @@ -222,10 +218,8 @@ XMLPUBFUN xmlEnumerationPtr xmlCreateEnumeration (const xmlChar *name); XMLPUBFUN void xmlFreeEnumeration (xmlEnumerationPtr cur); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlEnumerationPtr xmlCopyEnumeration (xmlEnumerationPtr cur); -#endif /* LIBXML_TREE_ENABLED */ /* Attribute */ XMLPUBFUN xmlAttributePtr @@ -238,10 +232,8 @@ XMLPUBFUN xmlAttributePtr xmlAttributeDefault def, const xmlChar *defaultValue, xmlEnumerationPtr tree); -#ifdef LIBXML_TREE_ENABLED XMLPUBFUN xmlAttributeTablePtr xmlCopyAttributeTable (xmlAttributeTablePtr table); -#endif /* LIBXML_TREE_ENABLED */ XMLPUBFUN void xmlFreeAttributeTable (xmlAttributeTablePtr table); #ifdef LIBXML_OUTPUT_ENABLED diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in index 0525b4ad..000a0fa9 100644 --- a/include/libxml/xmlversion.h.in +++ b/include/libxml/xmlversion.h.in @@ -67,11 +67,9 @@ /** * LIBXML_TREE_ENABLED: * - * Whether the DOM like tree manipulation API support is configured in + * Always enabled since 2.14.0 */ -#if @WITH_TREE@ #define LIBXML_TREE_ENABLED -#endif /** * LIBXML_OUTPUT_ENABLED: diff --git a/meson.build b/meson.build index b0281ff4..b5010d16 100644 --- a/meson.build +++ b/meson.build @@ -74,7 +74,6 @@ want_schemas = get_option('schemas') want_schematron = get_option('schematron') want_thread_alloc = get_option('thread-alloc') want_tls = get_option('tls') -want_tree = get_option('tree') want_valid = get_option('valid') want_writer = get_option('writer') want_xinclude = get_option('xinclude') @@ -114,10 +113,6 @@ if want_schematron == true message('-Dschematron=true overrides -Dpattern') endif want_pattern = true - if want_tree == false - message('-Dschematron=true overrides -Dtree') - endif - want_tree = true if want_xpath == false message('-Dschematron=true overrides -Dxpath') endif @@ -129,10 +124,6 @@ if want_reader == true message('-Dreader=true overrides -Dpush') endif want_push = true - if want_tree == false - message('-Dreader=true overrides -Dtree') - endif - want_tree = true endif if want_writer == true @@ -183,7 +174,6 @@ if get_option('minimum') want_schemas = false want_schematron = false want_thread_alloc = false - want_tree = false want_valid = false want_writer = false want_xinclude = false @@ -206,10 +196,6 @@ else if want_regexps == false want_schemas = false endif - if want_tree == false - want_reader = false - want_schematron = false - endif if want_xpath == false want_c14n = false want_schematron = false @@ -805,7 +791,6 @@ summary( 'threads': threads_dep.found(), 'thread-alloc': want_thread_alloc, 'tls': want_tls, - 'tree': want_tree, 'valid': want_valid, 'writer': want_writer, 'xinclude': want_xinclude, diff --git a/meson_options.txt b/meson_options.txt index c45fbbe9..c16c6d90 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -26,7 +26,6 @@ # [X] threads # [X] thread-alloc # [X] tls -# [X] tree # [X] valid # [X] writer # [X] xinclude @@ -191,12 +190,6 @@ option('tls', description: 'thread-local storage' ) -option('tree', - type: 'boolean', - value: true, - description: 'DOM like tree manipulation APIs' -) - option('valid', type: 'boolean', value: true, diff --git a/parser.c b/parser.c index 54f6683f..60cee178 100644 --- a/parser.c +++ b/parser.c @@ -523,11 +523,7 @@ xmlHasFeature(xmlFeature feature) return(0); #endif case XML_WITH_TREE: -#ifdef LIBXML_TREE_ENABLED return(1); -#else - return(0); -#endif case XML_WITH_OUTPUT: #ifdef LIBXML_OUTPUT_ENABLED return(1); diff --git a/testapi.c b/testapi.c index 11de3ad2..054f0ac7 100644 --- a/testapi.c +++ b/testapi.c @@ -18583,7 +18583,6 @@ static int test_xmlAddPrevSibling(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) int mem_base; xmlNodePtr ret_val; xmlNodePtr next; /* the target node */ @@ -18615,7 +18614,6 @@ test_xmlAddPrevSibling(void) { } } function_tests++; -#endif return(test_ret); } @@ -19541,7 +19539,6 @@ static int test_xmlChildElementCount(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; unsigned long ret_val; xmlNodePtr parent; /* the parent node */ @@ -19565,7 +19562,6 @@ test_xmlChildElementCount(void) { } } function_tests++; -#endif return(test_ret); } @@ -19575,7 +19571,6 @@ static int test_xmlCopyDoc(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) int mem_base; xmlDocPtr ret_val; xmlDocPtr doc; /* the document */ @@ -19606,7 +19601,6 @@ test_xmlCopyDoc(void) { } } function_tests++; -#endif return(test_ret); } @@ -19616,7 +19610,6 @@ static int test_xmlCopyDtd(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlDtdPtr ret_val; xmlDtdPtr dtd; /* the DTD */ @@ -19640,7 +19633,6 @@ test_xmlCopyDtd(void) { } } function_tests++; -#endif return(test_ret); } @@ -20608,7 +20600,6 @@ static int test_xmlDocSetRootElement(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) int mem_base; xmlNodePtr ret_val; xmlDocPtr doc; /* the document */ @@ -20640,7 +20631,6 @@ test_xmlDocSetRootElement(void) { } } function_tests++; -#endif return(test_ret); } @@ -20696,7 +20686,6 @@ static int test_xmlFirstElementChild(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlNodePtr ret_val; xmlNodePtr parent; /* the parent node */ @@ -20720,7 +20709,6 @@ test_xmlFirstElementChild(void) { } } function_tests++; -#endif return(test_ret); } @@ -20947,7 +20935,6 @@ static int test_xmlGetNodePath(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) int mem_base; xmlChar * ret_val; const xmlNode * node; /* a node */ @@ -20971,7 +20958,6 @@ test_xmlGetNodePath(void) { } } function_tests++; -#endif return(test_ret); } @@ -21242,7 +21228,6 @@ static int test_xmlLastElementChild(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlNodePtr ret_val; xmlNodePtr parent; /* the parent node */ @@ -21266,7 +21251,6 @@ test_xmlLastElementChild(void) { } } function_tests++; -#endif return(test_ret); } @@ -21364,8 +21348,6 @@ static int test_xmlNewChild(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; xmlNodePtr ret_val; xmlNodePtr parent; /* the parent node */ @@ -21410,8 +21392,6 @@ test_xmlNewChild(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -21524,7 +21504,6 @@ static int test_xmlNewDocFragment(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlNodePtr ret_val; xmlDocPtr doc; /* the target document (optional) */ @@ -21548,7 +21527,6 @@ test_xmlNewDocFragment(void) { } } function_tests++; -#endif return(test_ret); } @@ -21756,8 +21734,6 @@ static int test_xmlNewDocRawNode(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; xmlNodePtr ret_val; xmlDocPtr doc; /* the target document */ @@ -21802,8 +21778,6 @@ test_xmlNewDocRawNode(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -22224,8 +22198,6 @@ static int test_xmlNewProp(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; xmlAttrPtr ret_val; xmlNodePtr node; /* the parent node (optional) */ @@ -22263,8 +22235,6 @@ test_xmlNewProp(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -22345,8 +22315,6 @@ static int test_xmlNewTextChild(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; xmlNodePtr ret_val; xmlNodePtr parent; /* the parent node */ @@ -22391,8 +22359,6 @@ test_xmlNewTextChild(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -22444,7 +22410,6 @@ static int test_xmlNextElementSibling(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlNodePtr ret_val; xmlNodePtr node; /* the current node */ @@ -22468,7 +22433,6 @@ test_xmlNextElementSibling(void) { } } function_tests++; -#endif return(test_ret); } @@ -23000,7 +22964,6 @@ static int test_xmlNodeListGetRawString(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlChar * ret_val; const xmlDoc * doc; /* a document (optional) */ @@ -23038,7 +23001,6 @@ test_xmlNodeListGetRawString(void) { } } function_tests++; -#endif return(test_ret); } @@ -23094,7 +23056,6 @@ static int test_xmlNodeSetBase(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) int mem_base; int ret_val; xmlNodePtr cur; /* the node being changed */ @@ -23125,7 +23086,6 @@ test_xmlNodeSetBase(void) { } } function_tests++; -#endif return(test_ret); } @@ -23174,7 +23134,6 @@ static int test_xmlNodeSetContentLen(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; int ret_val; xmlNodePtr cur; /* the node being modified */ @@ -23215,7 +23174,6 @@ test_xmlNodeSetContentLen(void) { } } function_tests++; -#endif return(test_ret); } @@ -23225,7 +23183,6 @@ static int test_xmlNodeSetLang(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; int ret_val; xmlNodePtr cur; /* the node being changed */ @@ -23256,7 +23213,6 @@ test_xmlNodeSetLang(void) { } } function_tests++; -#endif return(test_ret); } @@ -23266,7 +23222,6 @@ static int test_xmlNodeSetName(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlNodePtr cur; /* the node being changed */ int n_cur; @@ -23295,7 +23250,6 @@ test_xmlNodeSetName(void) { } } function_tests++; -#endif return(test_ret); } @@ -23305,7 +23259,6 @@ static int test_xmlNodeSetSpacePreserve(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; int ret_val; xmlNodePtr cur; /* the node being changed */ @@ -23336,7 +23289,6 @@ test_xmlNodeSetSpacePreserve(void) { } } function_tests++; -#endif return(test_ret); } @@ -23346,7 +23298,6 @@ static int test_xmlPreviousElementSibling(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) int mem_base; xmlNodePtr ret_val; xmlNodePtr node; /* the current node */ @@ -23370,7 +23321,6 @@ test_xmlPreviousElementSibling(void) { } } function_tests++; -#endif return(test_ret); } @@ -23380,8 +23330,6 @@ static int test_xmlReconciliateNs(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; xmlDocPtr doc; /* the document */ @@ -23412,8 +23360,6 @@ test_xmlReconciliateNs(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -23466,7 +23412,6 @@ static int test_xmlReplaceNode(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) int mem_base; xmlNodePtr ret_val; xmlNodePtr old; /* the old node */ @@ -23504,7 +23449,6 @@ test_xmlReplaceNode(void) { } } function_tests++; -#endif return(test_ret); } @@ -24037,7 +23981,6 @@ static int test_xmlSetNsProp(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) int mem_base; xmlAttrPtr ret_val; xmlNodePtr node; /* the node */ @@ -24082,7 +24025,6 @@ test_xmlSetNsProp(void) { } } function_tests++; -#endif return(test_ret); } @@ -24092,7 +24034,6 @@ static int test_xmlSetProp(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) int mem_base; xmlAttrPtr ret_val; xmlNodePtr node; /* the node */ @@ -24130,7 +24071,6 @@ test_xmlSetProp(void) { } } function_tests++; -#endif return(test_ret); } @@ -24482,7 +24422,6 @@ static int test_xmlUnsetNsProp(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; xmlNodePtr node; /* the node */ @@ -24520,7 +24459,6 @@ test_xmlUnsetNsProp(void) { } } function_tests++; -#endif return(test_ret); } @@ -24530,7 +24468,6 @@ static int test_xmlUnsetProp(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) int mem_base; int ret_val; xmlNodePtr node; /* the node */ @@ -24561,7 +24498,6 @@ test_xmlUnsetProp(void) { } } function_tests++; -#endif return(test_ret); } @@ -24571,7 +24507,6 @@ static int test_xmlValidateNCName(void) { int test_ret = 0; -#ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; const xmlChar * value; /* the value to check */ @@ -24602,7 +24537,6 @@ test_xmlValidateNCName(void) { } } function_tests++; -#endif return(test_ret); } @@ -24612,8 +24546,6 @@ static int test_xmlValidateNMToken(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; const xmlChar * value; /* the value to check */ @@ -24644,8 +24576,6 @@ test_xmlValidateNMToken(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -24655,8 +24585,6 @@ static int test_xmlValidateName(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; const xmlChar * value; /* the value to check */ @@ -24687,8 +24615,6 @@ test_xmlValidateName(void) { } } function_tests++; -#endif -#endif return(test_ret); } @@ -24698,8 +24624,6 @@ static int test_xmlValidateQName(void) { int test_ret = 0; -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) -#ifdef LIBXML_TREE_ENABLED int mem_base; int ret_val; const xmlChar * value; /* the value to check */ @@ -24730,8 +24654,6 @@ test_xmlValidateQName(void) { } } function_tests++; -#endif -#endif return(test_ret); } diff --git a/tree.c b/tree.c index d5de7284..ee8a8882 100644 --- a/tree.c +++ b/tree.c @@ -99,7 +99,6 @@ static int xmlCompressMode = 0; ************************************************************************/ #include -#ifdef LIBXML_TREE_ENABLED /** * xmlGetEntityFromDtd: * @dtd: A pointer to the DTD to search @@ -142,7 +141,6 @@ xmlGetParameterEntityFromDtd(const xmlDtd *dtd, const xmlChar *name) { } return(NULL); } -#endif /* LIBXML_TREE_ENABLED */ /************************************************************************ * * @@ -418,7 +416,6 @@ try_complex: return(0); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /** * xmlValidateQName: * @value: the value to check @@ -657,7 +654,6 @@ try_complex: return(1); return(0); } -#endif /* LIBXML_TREE_ENABLED */ /************************************************************************ * * @@ -1626,7 +1622,6 @@ xmlNodeListGetString(xmlDocPtr doc, const xmlNode *list, int inLine) return(xmlNodeListGetStringInternal(doc, list, escMode)); } -#ifdef LIBXML_TREE_ENABLED /** * xmlNodeListGetRawString: * @doc: a document (optional) @@ -1648,7 +1643,6 @@ xmlNodeListGetRawString(const xmlDoc *doc, const xmlNode *list, int inLine) int escMode = inLine ? 0 : 3; return(xmlNodeListGetStringInternal((xmlDocPtr) doc, list, escMode)); } -#endif /* LIBXML_TREE_ENABLED */ static xmlAttrPtr xmlNewPropInternal(xmlNodePtr node, xmlNsPtr ns, @@ -1748,8 +1742,6 @@ error: return(NULL); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) /** * xmlNewProp: * @node: the parent node (optional) @@ -1776,7 +1768,6 @@ xmlNewProp(xmlNodePtr node, const xmlChar *name, const xmlChar *value) { return xmlNewPropInternal(node, NULL, name, value, 0); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNewNsProp: @@ -2198,7 +2189,6 @@ xmlNewDocNodeEatName(xmlDocPtr doc, xmlNsPtr ns, return(cur); } -#ifdef LIBXML_TREE_ENABLED /** * xmlNewDocRawNode: * @doc: the target document @@ -2266,7 +2256,6 @@ xmlNewDocFragment(xmlDocPtr doc) { xmlRegisterNodeDefaultValue(cur); return(cur); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNewText: @@ -2308,7 +2297,6 @@ error: return(NULL); } -#ifdef LIBXML_TREE_ENABLED /** * xmlNewTextChild: * @parent: the parent node @@ -2370,7 +2358,6 @@ xmlNewTextChild(xmlNodePtr parent, xmlNsPtr ns, return(cur); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNewEntityRef: @@ -2920,7 +2907,6 @@ xmlSetListDoc(xmlNodePtr list, xmlDocPtr doc) { return(ret); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /** * xmlNewChild: * @parent: the parent node @@ -2984,7 +2970,6 @@ xmlNewChild(xmlNodePtr parent, xmlNsPtr ns, return(cur); } -#endif /* LIBXML_TREE_ENABLED */ static void xmlTextSetContent(xmlNodePtr text, xmlChar *content) { @@ -3177,8 +3162,6 @@ xmlAddNextSibling(xmlNodePtr prev, xmlNodePtr cur) { return(xmlInsertNode(prev->doc, cur, prev->parent, prev, prev->next, 0)); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_HTML_ENABLED) || \ - defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) /** * xmlAddPrevSibling: * @next: the target node @@ -3209,7 +3192,6 @@ xmlAddPrevSibling(xmlNodePtr next, xmlNodePtr cur) { return(xmlInsertNode(next->doc, cur, next->parent, next->prev, next, 0)); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlAddSibling: @@ -3428,7 +3410,6 @@ xmlGetLastChild(const xmlNode *parent) { return(parent->last); } -#ifdef LIBXML_TREE_ENABLED /* * 5 interfaces from DOM ElementTraversal */ @@ -3613,8 +3594,6 @@ xmlNextElementSibling(xmlNodePtr node) { return(NULL); } -#endif /* LIBXML_TREE_ENABLED */ - /** * xmlFreeNodeList: * @cur: the first node in the list @@ -3839,7 +3818,6 @@ xmlUnlinkNode(xmlNodePtr cur) { xmlUnlinkNodeInternal(cur); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) /** * xmlReplaceNode: * @old: the old node @@ -3901,7 +3879,6 @@ xmlReplaceNode(xmlNodePtr old, xmlNodePtr cur) { old->parent = NULL; return(old); } -#endif /* LIBXML_TREE_ENABLED */ /************************************************************************ * * @@ -4195,9 +4172,7 @@ xmlStaticCopyNode(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent, case XML_DOCUMENT_NODE: case XML_HTML_DOCUMENT_NODE: -#ifdef LIBXML_TREE_ENABLED return((xmlNodePtr) xmlCopyDoc((xmlDocPtr) node, extended)); -#endif /* LIBXML_TREE_ENABLED */ default: return(NULL); } @@ -4379,7 +4354,6 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) { while (node != NULL) { xmlNodePtr next = node->next; -#ifdef LIBXML_TREE_ENABLED if (node->type == XML_DTD_NODE ) { if (doc == NULL) { node = next; @@ -4417,7 +4391,6 @@ xmlStaticCopyNodeList(xmlNodePtr node, xmlDocPtr doc, xmlNodePtr parent) { q->prev = NULL; } } else -#endif /* LIBXML_TREE_ENABLED */ q = xmlStaticCopyNode(node, doc, parent, 1); if (q == NULL) goto error; if (ret == NULL) { @@ -4517,7 +4490,6 @@ xmlNodePtr xmlCopyNodeList(xmlNodePtr node) { return(ret); } -#if defined(LIBXML_TREE_ENABLED) /** * xmlCopyDtd: * @dtd: the DTD @@ -4623,9 +4595,7 @@ error: xmlFreeDtd(ret); return(NULL); } -#endif -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /** * xmlCopyDoc: * @doc: the document @@ -4667,7 +4637,6 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) { ret->last = NULL; ret->children = NULL; -#ifdef LIBXML_TREE_ENABLED if (doc->intSubset != NULL) { ret->intSubset = xmlCopyDtd(doc->intSubset); if (ret->intSubset == NULL) @@ -4675,7 +4644,6 @@ xmlCopyDoc(xmlDocPtr doc, int recursive) { /* Can't fail on DTD */ xmlSetTreeDoc((xmlNodePtr)ret->intSubset, ret); } -#endif if (doc->oldNs != NULL) { ret->oldNs = xmlCopyNamespaceList(doc->oldNs); if (ret->oldNs == NULL) @@ -4702,7 +4670,6 @@ error: xmlFreeDoc(ret); return(NULL); } -#endif /* LIBXML_TREE_ENABLED */ /************************************************************************ * * @@ -4776,7 +4743,6 @@ xmlGetLineNo(const xmlNode *node) return(xmlGetLineNoInternal(node, 0)); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) /** * xmlGetNodePath: * @node: a node @@ -5018,7 +4984,6 @@ xmlGetNodePath(const xmlNode *node) xmlFree(buf); return (buffer); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlDocGetRootElement: @@ -5043,7 +5008,6 @@ xmlDocGetRootElement(const xmlDoc *doc) { return(ret); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_WRITER_ENABLED) /** * xmlDocSetRootElement: * @doc: the document @@ -5089,9 +5053,7 @@ xmlDocSetRootElement(xmlDocPtr doc, xmlNodePtr root) { } return(old); } -#endif -#if defined(LIBXML_TREE_ENABLED) /** * xmlNodeSetLang: * @cur: the node being changed @@ -5121,7 +5083,6 @@ xmlNodeSetLang(xmlNodePtr cur, const xmlChar *lang) { return(0); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNodeGetLang: @@ -5156,7 +5117,6 @@ xmlNodeGetLang(const xmlNode *cur) { } -#ifdef LIBXML_TREE_ENABLED /** * xmlNodeSetSpacePreserve: * @cur: the node being changed @@ -5193,7 +5153,6 @@ xmlNodeSetSpacePreserve(xmlNodePtr cur, int val) { return(0); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNodeGetSpacePreserve: @@ -5236,7 +5195,6 @@ xmlNodeGetSpacePreserve(const xmlNode *cur) { return(-1); } -#ifdef LIBXML_TREE_ENABLED /** * xmlNodeSetName: * @cur: the node being changed @@ -5282,9 +5240,7 @@ xmlNodeSetName(xmlNodePtr cur, const xmlChar *name) { ((dict == NULL) || (!xmlDictOwns(dict, oldName)))) xmlFree((xmlChar *) oldName); } -#endif -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) /** * xmlNodeSetBase: * @cur: the node being changed @@ -5339,7 +5295,6 @@ xmlNodeSetBase(xmlNodePtr cur, const xmlChar* uri) { return(0); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNodeGetBaseSafe: @@ -5763,7 +5718,6 @@ xmlNodeSetContent(xmlNodePtr cur, const xmlChar *content) { return(xmlNodeSetContentInternal(cur, content, -1)); } -#ifdef LIBXML_TREE_ENABLED /** * xmlNodeSetContentLen: * @cur: the node being modified @@ -5778,7 +5732,6 @@ int xmlNodeSetContentLen(xmlNodePtr cur, const xmlChar *content, int len) { return(xmlNodeSetContentInternal(cur, content, len)); } -#endif /* LIBXML_TREE_ENABLED */ /** * xmlNodeAddContentLen: @@ -5872,7 +5825,6 @@ xmlTextMerge(xmlNodePtr first, xmlNodePtr second) { return(first); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XPATH_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /** * xmlGetNsListSafe: * @doc: the document @@ -5962,7 +5914,6 @@ xmlGetNsList(const xmlDoc *doc, const xmlNode *node) xmlGetNsListSafe(doc, node, &ret); return(ret); } -#endif /* LIBXML_TREE_ENABLED */ static xmlNsPtr xmlNewXmlNs(void) { @@ -6342,8 +6293,6 @@ xmlNewReconciledNs(xmlNodePtr tree, xmlNsPtr ns) { return(def); } -#ifdef LIBXML_TREE_ENABLED - typedef struct { xmlNsPtr oldNs; xmlNsPtr newNs; @@ -6502,7 +6451,6 @@ xmlReconciliateNs(xmlDocPtr doc, xmlNodePtr tree) { xmlFree(cache); return(ret); } -#endif /* LIBXML_TREE_ENABLED */ static xmlAttrPtr xmlGetPropNodeInternal(const xmlNode *node, const xmlChar *name, @@ -6544,7 +6492,6 @@ xmlGetPropNodeInternal(const xmlNode *node, const xmlChar *name, } } -#ifdef LIBXML_TREE_ENABLED if (! useDTD) return(NULL); /* @@ -6631,7 +6578,7 @@ xmlGetPropNodeInternal(const xmlNode *node, const xmlChar *name, if ((attrDecl != NULL) && (attrDecl->defaultValue != NULL)) return((xmlAttrPtr) attrDecl); } -#endif /* LIBXML_TREE_ENABLED */ + return(NULL); } @@ -6844,7 +6791,6 @@ xmlGetNsProp(const xmlNode *node, const xmlChar *name, const xmlChar *nameSpace) return(xmlGetPropNodeValueInternal(prop)); } -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) /** * xmlUnsetProp: * @node: the node @@ -6887,9 +6833,7 @@ xmlUnsetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name) { xmlFreeProp(prop); return(0); } -#endif -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_XINCLUDE_ENABLED) || defined(LIBXML_SCHEMAS_ENABLED) || defined(LIBXML_HTML_ENABLED) /** * xmlSetProp: * @node: the node @@ -7003,8 +6947,6 @@ xmlSetNsProp(xmlNodePtr node, xmlNsPtr ns, const xmlChar *name, return(xmlNewPropInternal(node, ns, name, value, 0)); } -#endif /* LIBXML_TREE_ENABLED */ - /** * xmlNodeIsText: * @node: the node diff --git a/valid.c b/valid.c index 1b711e64..832e839f 100644 --- a/valid.c +++ b/valid.c @@ -1353,7 +1353,6 @@ xmlFreeElementTable(xmlElementTablePtr table) { xmlHashFree(table, xmlFreeElementTableEntry); } -#ifdef LIBXML_TREE_ENABLED /** * xmlCopyElement: * @elem: An element @@ -1409,7 +1408,6 @@ xmlElementTablePtr xmlCopyElementTable(xmlElementTablePtr table) { return(xmlHashCopySafe(table, xmlCopyElement, xmlFreeElementTableEntry)); } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_OUTPUT_ENABLED /** @@ -1519,7 +1517,6 @@ xmlFreeEnumeration(xmlEnumerationPtr cur) { } } -#ifdef LIBXML_TREE_ENABLED /** * xmlCopyEnumeration: * @cur: the tree to copy. @@ -1554,7 +1551,6 @@ xmlCopyEnumeration(xmlEnumerationPtr cur) { return(ret); } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_VALID_ENABLED /** @@ -1892,7 +1888,6 @@ xmlFreeAttributeTable(xmlAttributeTablePtr table) { xmlHashFree(table, xmlFreeAttributeTableEntry); } -#ifdef LIBXML_TREE_ENABLED /** * xmlCopyAttribute: * @attr: An attribute @@ -1958,7 +1953,6 @@ xmlCopyAttributeTable(xmlAttributeTablePtr table) { return(xmlHashCopySafe(table, xmlCopyAttribute, xmlFreeAttributeTableEntry)); } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_OUTPUT_ENABLED /** @@ -2150,7 +2144,6 @@ xmlFreeNotationTable(xmlNotationTablePtr table) { xmlHashFree(table, xmlFreeNotationTableEntry); } -#ifdef LIBXML_TREE_ENABLED /** * xmlCopyNotation: * @nota: A notation @@ -2202,7 +2195,6 @@ xmlNotationTablePtr xmlCopyNotationTable(xmlNotationTablePtr table) { return(xmlHashCopySafe(table, xmlCopyNotation, xmlFreeNotationTableEntry)); } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_OUTPUT_ENABLED /** diff --git a/xmllint.c b/xmllint.c index e603f209..2f725b8a 100644 --- a/xmllint.c +++ b/xmllint.c @@ -116,9 +116,7 @@ static int debugent = 0; #endif static int debug = 0; static int maxmem = 0; -#ifdef LIBXML_TREE_ENABLED static int copy = 0; -#endif /* LIBXML_TREE_ENABLED */ static int noout = 0; #ifdef LIBXML_OUTPUT_ENABLED static const char *output = NULL; @@ -1589,13 +1587,8 @@ static void processNode(xmlTextReaderPtr reader) { match = xmlPatternMatch(patternc, xmlTextReaderCurrentNode(reader)); if (match) { -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) path = xmlGetNodePath(xmlTextReaderCurrentNode(reader)); printf("Node %s matches pattern %s\n", path, pattern); -#else - printf("Node %s matches pattern %s\n", - xmlTextReaderConstName(reader), pattern); -#endif } } if (patstream != NULL) { @@ -1610,12 +1603,10 @@ static void processNode(xmlTextReaderPtr reader) { xmlFreeStreamCtxt(patstream); patstream = NULL; } else if (ret != match) { -#if defined(LIBXML_TREE_ENABLED) || defined(LIBXML_DEBUG_ENABLED) if (path == NULL) { path = xmlGetNodePath( xmlTextReaderCurrentNode(reader)); } -#endif fprintf(ERR_STREAM, "xmlPatternMatch and xmlStreamPush disagree\n"); if (path != NULL) @@ -2004,7 +1995,6 @@ parseFile(const char *filename, xmlParserCtxtPtr rectxt) { xmlParserCtxtPtr ctxt; xmlDocPtr doc = NULL; -#ifdef LIBXML_TREE_ENABLED if ((generate) && (filename == NULL)) { xmlNodePtr n; @@ -2029,7 +2019,6 @@ parseFile(const char *filename, xmlParserCtxtPtr rectxt) { return(doc); } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_HTML_ENABLED #ifdef LIBXML_PUSH_ENABLED @@ -2311,7 +2300,6 @@ parseAndPrintFile(const char *filename, xmlParserCtxtPtr rectxt) { #endif #endif -#ifdef LIBXML_TREE_ENABLED /* * test intermediate copy if needed. */ @@ -2339,7 +2327,6 @@ parseAndPrintFile(const char *filename, xmlParserCtxtPtr rectxt) { endTimer("Freeing original"); } } -#endif /* LIBXML_TREE_ENABLED */ #ifdef LIBXML_VALID_ENABLED if ((insert) @@ -2832,9 +2819,7 @@ static void usage(FILE *f, const char *name) { fprintf(f, "\t--debug : dump the nodes content when using --stream\n"); #endif /* LIBXML_READER_ENABLED */ #endif -#ifdef LIBXML_TREE_ENABLED fprintf(f, "\t--copy : used to test the internal copy implementation\n"); -#endif /* LIBXML_TREE_ENABLED */ fprintf(f, "\t--recover : output what was parsable on broken XML documents\n"); fprintf(f, "\t--huge : remove any internal arbitrary parser limits\n"); fprintf(f, "\t--noent : substitute entity references by their value\n"); @@ -3025,9 +3010,7 @@ xmllintMain(int argc, const char **argv, xmlResourceLoader loader) { #endif debug = 0; maxmem = 0; -#ifdef LIBXML_TREE_ENABLED copy = 0; -#endif /* LIBXML_TREE_ENABLED */ noout = 0; #ifdef LIBXML_OUTPUT_ENABLED format = 0; @@ -3132,11 +3115,9 @@ xmllintMain(int argc, const char **argv, xmlResourceLoader loader) { noout = 1; } else #endif -#ifdef LIBXML_TREE_ENABLED if ((!strcmp(argv[i], "-copy")) || (!strcmp(argv[i], "--copy"))) copy++; else -#endif /* LIBXML_TREE_ENABLED */ if ((!strcmp(argv[i], "-recover")) || (!strcmp(argv[i], "--recover"))) { options |= XML_PARSE_RECOVER;