Skip to content

Commit

Permalink
Issue #5: ensure that we reset our static variables
Browse files Browse the repository at this point in the history
  • Loading branch information
kpdyer committed Jun 25, 2014
1 parent 0aa6fde commit b0b2ba9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/regex2dfa.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

namespace regex2dfa {

std::map< std::string, uint32_t > state_map;
uint32_t state_counter = 0;
static std::map< std::string, uint32_t > state_map;
static uint32_t state_counter = 0;

bool AttFstFromRegex(const std::string & regex, std::string * dfa) {
// specify compile flags for re2
Expand Down Expand Up @@ -173,6 +173,9 @@ bool AttFstMinimize(const std::string & str_dfa,

bool Regex2Dfa(const std::string & regex,
std::string * minimized_dfa) {
state_counter = 0;
state_map.clear();

bool success = false;
std::string dfa;
bool compile_success = AttFstFromRegex(regex, &dfa);
Expand Down

0 comments on commit b0b2ba9

Please sign in to comment.