mirror of https://github.com/kiwix/libkiwix.git
Fix regexTools.
The buildMatcher must not take a rvalue as it will keep a reference to it.
This commit is contained in:
parent
fee2da57e6
commit
c4963268ba
|
@ -30,7 +30,7 @@
|
|||
std::map<std::string, std::shared_ptr<icu::RegexPattern>> regexCache;
|
||||
static pthread_mutex_t regexLock = PTHREAD_MUTEX_INITIALIZER;
|
||||
|
||||
std::unique_ptr<icu::RegexMatcher> buildMatcher(const std::string& regex, const icu::UnicodeString& content)
|
||||
std::unique_ptr<icu::RegexMatcher> buildMatcher(const std::string& regex, icu::UnicodeString& content)
|
||||
{
|
||||
std::shared_ptr<icu::RegexPattern> pattern;
|
||||
/* Regex is in cache */
|
||||
|
@ -56,7 +56,8 @@ std::unique_ptr<icu::RegexMatcher> buildMatcher(const std::string& regex, const
|
|||
bool matchRegex(const std::string& content, const std::string& regex)
|
||||
{
|
||||
ucnv_setDefaultName("UTF-8");
|
||||
auto matcher = buildMatcher(regex, content.c_str());
|
||||
icu::UnicodeString ucontent(content.c_str());
|
||||
auto matcher = buildMatcher(regex, ucontent);
|
||||
return matcher->find();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue