[libxml2] Move xmlIsXHTML to tree.c



commit bdcf842cdbe817e894ed01c1edfe5e622a53cdf2
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Thu Sep 1 20:45:35 2022 +0200

    Move xmlIsXHTML to tree.c
    
    It's declared in tree.h and not guarded by LIBXML_OUTPUT_ENABLED like
    the other functions in xmlsave.c.

 tree.c    | 45 +++++++++++++++++++++++++++++++++++++++++++++
 xmlsave.c | 45 +--------------------------------------------
 2 files changed, 46 insertions(+), 44 deletions(-)
---
diff --git a/tree.c b/tree.c
index 36b0a77a..612c19fd 100644
--- a/tree.c
+++ b/tree.c
@@ -10250,3 +10250,48 @@ xmlDOMWrapAdoptNode(xmlDOMWrapCtxtPtr ctxt,
     return (0);
 }
 
+/************************************************************************
+ *                                                                     *
+ *                     XHTML detection                                 *
+ *                                                                     *
+ ************************************************************************/
+
+#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
+   "-//W3C//DTD XHTML 1.0 Strict//EN"
+#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
+#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
+   "-//W3C//DTD XHTML 1.0 Frameset//EN"
+#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd";
+#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
+   "-//W3C//DTD XHTML 1.0 Transitional//EN"
+#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
+   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
+
+/**
+ * xmlIsXHTML:
+ * @systemID:  the system identifier
+ * @publicID:  the public identifier
+ *
+ * Try to find if the document correspond to an XHTML DTD
+ *
+ * Returns 1 if true, 0 if not and -1 in case of error
+ */
+int
+xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
+    if ((systemID == NULL) && (publicID == NULL))
+       return(-1);
+    if (publicID != NULL) {
+       if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
+       if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
+       if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
+    }
+    if (systemID != NULL) {
+       if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
+       if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
+       if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
+    }
+    return(0);
+}
+
diff --git a/xmlsave.c b/xmlsave.c
index 17bc37ea..77cb7b9b 100644
--- a/xmlsave.c
+++ b/xmlsave.c
@@ -24,52 +24,9 @@
 #include "private/error.h"
 #include "private/save.h"
 
-/************************************************************************
- *                                                                     *
- *                     XHTML detection                                 *
- *                                                                     *
- ************************************************************************/
-#define XHTML_STRICT_PUBLIC_ID BAD_CAST \
-   "-//W3C//DTD XHTML 1.0 Strict//EN"
-#define XHTML_STRICT_SYSTEM_ID BAD_CAST \
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";
-#define XHTML_FRAME_PUBLIC_ID BAD_CAST \
-   "-//W3C//DTD XHTML 1.0 Frameset//EN"
-#define XHTML_FRAME_SYSTEM_ID BAD_CAST \
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd";
-#define XHTML_TRANS_PUBLIC_ID BAD_CAST \
-   "-//W3C//DTD XHTML 1.0 Transitional//EN"
-#define XHTML_TRANS_SYSTEM_ID BAD_CAST \
-   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";
+#ifdef LIBXML_OUTPUT_ENABLED
 
 #define XHTML_NS_NAME BAD_CAST "http://www.w3.org/1999/xhtml";
-/**
- * xmlIsXHTML:
- * @systemID:  the system identifier
- * @publicID:  the public identifier
- *
- * Try to find if the document correspond to an XHTML DTD
- *
- * Returns 1 if true, 0 if not and -1 in case of error
- */
-int
-xmlIsXHTML(const xmlChar *systemID, const xmlChar *publicID) {
-    if ((systemID == NULL) && (publicID == NULL))
-       return(-1);
-    if (publicID != NULL) {
-       if (xmlStrEqual(publicID, XHTML_STRICT_PUBLIC_ID)) return(1);
-       if (xmlStrEqual(publicID, XHTML_FRAME_PUBLIC_ID)) return(1);
-       if (xmlStrEqual(publicID, XHTML_TRANS_PUBLIC_ID)) return(1);
-    }
-    if (systemID != NULL) {
-       if (xmlStrEqual(systemID, XHTML_STRICT_SYSTEM_ID)) return(1);
-       if (xmlStrEqual(systemID, XHTML_FRAME_SYSTEM_ID)) return(1);
-       if (xmlStrEqual(systemID, XHTML_TRANS_SYSTEM_ID)) return(1);
-    }
-    return(0);
-}
-
-#ifdef LIBXML_OUTPUT_ENABLED
 
 #define TODO                                                           \
     xmlGenericError(xmlGenericErrorContext,                            \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]