| 958 | } |
| 959 | |
| 960 | PCRE* GetCachedPCRE(const char* regexp) { |
| 961 | static auto& mutex = *new Mutex; |
| 962 | MutexLock lock(&mutex); |
| 963 | static auto& cache = *new std::unordered_map<std::string, PCRE*>; |
| 964 | PCRE* re = cache[regexp]; |
| 965 | if (re == NULL) { |
| 966 | re = new PCRE(regexp, PCRE::UTF8); |
| 967 | CHECK_EQ(re->error(), ""); |
| 968 | cache[regexp] = re; |
| 969 | } |
| 970 | return re; |
| 971 | } |
| 972 | |
| 973 | RE2* GetCachedRE2(const char* regexp) { |
| 974 | static auto& mutex = *new Mutex; |
no test coverage detected