MCPcopy Create free account
hub / github.com/BYVoid/OpenCC / PruneExpiredPrefixMatchCache

Function PruneExpiredPrefixMatchCache

src/PrefixMatch.cpp:96–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94}
95
96void PruneExpiredPrefixMatchCache(
97 std::unordered_map<std::string, std::vector<CacheEntry>>* cache) {
98 for (std::unordered_map<std::string, std::vector<CacheEntry>>::iterator it =
99 cache->begin();
100 it != cache->end();) {
101 std::vector<CacheEntry>& entries = it->second;
102 for (std::vector<CacheEntry>::iterator entry = entries.begin();
103 entry != entries.end();) {
104 if (HasExpiredDict(*entry)) {
105 entry = entries.erase(entry);
106 } else {
107 ++entry;
108 }
109 }
110 if (entries.empty()) {
111 it = cache->erase(it);
112 } else {
113 ++it;
114 }
115 }
116}
117
118void Unreachable() {
119#if defined(_MSC_VER)

Callers 1

PrefixMatchMethod · 0.85

Calls 4

HasExpiredDictFunction · 0.85
beginMethod · 0.45
endMethod · 0.45
emptyMethod · 0.45

Tested by

no test coverage detected