commit 3bf1b97ae547aea5d0243e41b2d8af463a6e40c5
Author: Thibaut Cuvelier <[email protected]>
Date: Mon Oct 31 23:57:41 2022 +0100
InsetIndex: hide printTree behind a LYX_INSET_INDEX_DEBUG flag
The change ensures that the function is not seen by the compiler when
the debug mode is not enabled. The flag is not set by default, because
it might have a significant performance impact for large indices.
The reason for the flag is that the default configuration under Linux
forbids the definition of unused functions.
---
src/insets/InsetIndex.cpp | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/insets/InsetIndex.cpp b/src/insets/InsetIndex.cpp
index 0a14372..13a7b4d 100644
--- a/src/insets/InsetIndex.cpp
+++ b/src/insets/InsetIndex.cpp
@@ -55,6 +55,9 @@
using namespace std;
using namespace lyx::support;
+// Uncomment to enable InsetIndex-specific debugging mode: the tree for the
index will be printed to std::cout.
+// #define LYX_INSET_INDEX_DEBUG
+
namespace lyx {
namespace {
@@ -1687,7 +1690,7 @@ void outputIndexPage(XMLStream & xs, const IndexNode*
root_node, unsigned depth
xs << xml::CR();
}
-// Only useful for debugging.
+#ifdef LYX_INSET_INDEX_DEBUG
void printTree(const IndexNode* root_node, unsigned depth = 0)
{
static const std::string pattern = " ";
@@ -1722,6 +1725,7 @@ void printTree(const IndexNode* root_node, unsigned depth
= 0)
printTree(node, depth + 1);
}
}
+#endif // LYX_INSET_INDEX_DEBUG
}
@@ -1747,7 +1751,7 @@ docstring InsetPrintIndex::xhtml(XMLStream &,
OutputParams const & op) const
return docstring();
const IndexNode* index_root = buildIndexTree(entries);
-#if 0
+#ifdef LYX_INSET_INDEX_DEBUG
printTree(index_root);
#endif
--
lyx-cvs mailing list
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-cvs