diff options
Diffstat (limited to 'libqpdf/QTC.cc')
-rw-r--r-- | libqpdf/QTC.cc | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libqpdf/QTC.cc b/libqpdf/QTC.cc index d27bfa8b..8188846c 100644 --- a/libqpdf/QTC.cc +++ b/libqpdf/QTC.cc @@ -1,6 +1,7 @@ #include <qpdf/QTC.hh> #include <qpdf/QUtil.hh> +#include <map> #include <set> #include <stdio.h> @@ -12,14 +13,21 @@ tc_active(char const* const scope) } void -QTC::TC(char const* const scope, char const* const ccase, int n) +QTC::TC_real(char const* const scope, char const* const ccase, int n) { - static std::set<std::pair<std::string, int>> cache; + static std::map<std::string, bool> active; + auto is_active = active.find(scope); + if (is_active == active.end()) { + active[scope] = tc_active(scope); + is_active = active.find(scope); + } - if (!tc_active(scope)) { + if (!is_active->second) { return; } + static std::set<std::pair<std::string, int>> cache; + std::string filename; #ifdef _WIN32 # define TC_ENV "TC_WIN_FILENAME" |