MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / GetDFA

Method GetDFA

extern/re2/re2/dfa.cc:1779–1806  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1777}
1778
1779DFA* Prog::GetDFA(MatchKind kind) {
1780 // For a forward DFA, half the memory goes to each DFA.
1781 // However, if it is a "many match" DFA, then there is
1782 // no counterpart with which the memory must be shared.
1783 //
1784 // For a reverse DFA, all the memory goes to the
1785 // "longest match" DFA, because RE2 never does reverse
1786 // "first match" searches.
1787 if (kind == kFirstMatch) {
1788 std::call_once(dfa_first_once_, [](Prog* prog) {
1789 prog->dfa_first_ = new DFA(prog, kFirstMatch, prog->dfa_mem_ / 2);
1790 }, this);
1791 return dfa_first_;
1792 } else if (kind == kManyMatch) {
1793 std::call_once(dfa_first_once_, [](Prog* prog) {
1794 prog->dfa_first_ = new DFA(prog, kManyMatch, prog->dfa_mem_);
1795 }, this);
1796 return dfa_first_;
1797 } else {
1798 std::call_once(dfa_longest_once_, [](Prog* prog) {
1799 if (!prog->reversed_)
1800 prog->dfa_longest_ = new DFA(prog, kLongestMatch, prog->dfa_mem_ / 2);
1801 else
1802 prog->dfa_longest_ = new DFA(prog, kLongestMatch, prog->dfa_mem_);
1803 }, this);
1804 return dfa_longest_;
1805 }
1806}
1807
1808void Prog::DeleteDFA(DFA* dfa) {
1809 delete dfa;

Callers

nothing calls this directly

Calls 1

call_onceFunction · 0.50

Tested by

no test coverage detected