[libxslt] Hide unused code when compiling without debugger



commit 7503b1963887c93318d8f994e065045c81825193
Author: Nick Wellnhofer <wellnhofer aevum de>
Date:   Sat May 11 14:03:13 2019 +0200

    Hide unused code when compiling without debugger

 libxslt/transform.c |  2 ++
 libxslt/xsltutils.c | 67 +++++++++++++++++++++++++++++++++++++++++------------
 2 files changed, 54 insertions(+), 15 deletions(-)
---
diff --git a/libxslt/transform.c b/libxslt/transform.c
index b4c8a7cc..a9952c8d 100644
--- a/libxslt/transform.c
+++ b/libxslt/transform.c
@@ -2205,6 +2205,7 @@ xsltProcessOneNode(xsltTransformContextPtr ctxt, xmlNodePtr contextNode,
     }
 }
 
+#ifdef WITH_DEBUGGER
 static xmlNodePtr
 xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
                                     xmlNodePtr contextNode,
@@ -2240,6 +2241,7 @@ xsltDebuggerStartSequenceConstructor(xsltTransformContextPtr ctxt,
     }
     return(debugedNode);
 }
+#endif /* WITH_DEBUGGER */
 
 /**
  * xsltLocalVariablePush:
diff --git a/libxslt/xsltutils.c b/libxslt/xsltutils.c
index 5e957876..74bd6f0f 100644
--- a/libxslt/xsltutils.c
+++ b/libxslt/xsltutils.c
@@ -2346,6 +2346,23 @@ xsltXPathCompile(xsltStylesheetPtr style, const xmlChar *str) {
  *                                                                     *
  ************************************************************************/
 
+int xslDebugStatus;
+
+/**
+ * xsltGetDebuggerStatus:
+ *
+ * Get xslDebugStatus.
+ *
+ * Returns the value of xslDebugStatus.
+ */
+int
+xsltGetDebuggerStatus(void)
+{
+    return(xslDebugStatus);
+}
+
+#ifdef WITH_DEBUGGER
+
 /*
  * There is currently only 3 debugging callback defined
  * Debugger callbacks are disabled by default
@@ -2366,8 +2383,6 @@ static xsltDebuggerCallbacks xsltDebuggerCurrentCallbacks = {
     NULL  /* drop */
 };
 
-int xslDebugStatus;
-
 /**
  * xsltSetDebuggerStatus:
  * @value : the value to be set
@@ -2380,19 +2395,6 @@ xsltSetDebuggerStatus(int value)
     xslDebugStatus = value;
 }
 
-/**
- * xsltGetDebuggerStatus:
- *
- * Get xslDebugStatus.
- *
- * Returns the value of xslDebugStatus.
- */
-int
-xsltGetDebuggerStatus(void)
-{
-    return(xslDebugStatus);
-}
-
 /**
  * xsltSetDebuggerCallbacks:
  * @no : number of callbacks
@@ -2467,3 +2469,38 @@ xslDropCall(void)
        xsltDebuggerCurrentCallbacks.drop();
 }
 
+#else /* WITH_DEBUGGER */
+
+void
+xsltSetDebuggerStatus(int value) {
+    if (value != XSLT_DEBUG_NONE) {
+        xsltGenericError(xsltGenericErrorContext,
+                "xsltSetDebuggerStatus: libxslt compiled without debugger\n");
+    }
+}
+
+int
+xsltSetDebuggerCallbacks(int no ATTRIBUTE_UNUSED,
+                         void *block ATTRIBUTE_UNUSED) {
+    return(-1);
+}
+
+void
+xslHandleDebugger(xmlNodePtr cur ATTRIBUTE_UNUSED,
+                  xmlNodePtr node ATTRIBUTE_UNUSED,
+                  xsltTemplatePtr templ ATTRIBUTE_UNUSED,
+                 xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED) {
+}
+
+int
+xslAddCall(xsltTemplatePtr templ ATTRIBUTE_UNUSED,
+           xmlNodePtr source ATTRIBUTE_UNUSED) {
+    return(-1);
+}
+
+void
+xslDropCall(void) {
+}
+
+#endif /* WITH_DEBUGGER */
+


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