From cef6425bcac678157f58e9eafabb7e63c5831d18 Mon Sep 17 00:00:00 2001 From: Jay Berkenbilt Date: Sun, 7 Aug 2022 15:49:54 -0400 Subject: Disable QTC inside the library by default (fixes #714) This results in measurable performance improvements to packaged binary libqpdf distributions. QTC remains available for library users and is still selectively enabled in CI. --- include/qpdf/QTC.hh | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/qpdf/QTC.hh b/include/qpdf/QTC.hh index 1fa55901..70115981 100644 --- a/include/qpdf/QTC.hh +++ b/include/qpdf/QTC.hh @@ -24,10 +24,24 @@ #include +// Defining QPDF_DISABLE_QTC will effectively compile out any QTC::TC +// calls in any code that includes this file, but QTC will still be +// built into the library. That way, it is possible to build and +// package qpdf with QPDF_DISABLE_QTC while still making QTC::TC +// available to end users. + namespace QTC { QPDF_DLL - void TC(char const* const scope, char const* const ccase, int n = 0); + void TC_real(char const* const scope, char const* const ccase, int n = 0); + + inline void + TC(char const* const scope, char const* const ccase, int n = 0) + { +#ifndef QPDF_DISABLE_QTC + TC_real(scope, ccase, n); +#endif // QPDF_DISABLE_QTC + } }; // namespace QTC #endif // QTC_HH -- cgit v1.2.3-54-g00ecf