Skip to content

Commit

Permalink
Modify RE2 storage to avoid program shutdown crash
Browse files Browse the repository at this point in the history
  • Loading branch information
Myoldmopar committed Mar 29, 2021
1 parent 8452fa2 commit b311778
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/EnergyPlus/DataOutputs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ namespace EnergyPlus::DataOutputs {
break;
}
if (is_simple_string) return;
pattern = std::unique_ptr<RE2>(new RE2(KeyValue));
case_insensitive_pattern = std::unique_ptr<RE2>(new RE2("(?i)" + KeyValue));
pattern = new RE2(KeyValue);
case_insensitive_pattern = new RE2("(?i)" + KeyValue);
if (!pattern->ok()) {
ShowSevereError(state, "Regular expression \"" + KeyValue + "\" for variable name \"" + VariableName + "\" in input file is incorrect");
ShowContinueError(state, pattern->error());
Expand Down
4 changes: 2 additions & 2 deletions src/EnergyPlus/DataOutputs.hh
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ namespace DataOutputs {
std::string const key;
std::string const variableName;
bool is_simple_string = true;
std::unique_ptr<RE2> pattern;
std::unique_ptr<RE2> case_insensitive_pattern;
RE2 * pattern;
RE2 * case_insensitive_pattern;
};

// Check if a KeyValue/VariableName is inside the map OutputVariablesForSimulation
Expand Down

5 comments on commit b311778

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FinalGroundingAndDeglobalizing (Myoldmopar) - x86_64-MacOS-10.15-clang-11.0.0: OK (3079 of 3079 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FinalGroundingAndDeglobalizing (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1633 of 1633 tests passed, 0 test warnings)

Build Badge Test Badge Coverage Badge

@nrel-bot-2c
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FinalGroundingAndDeglobalizing (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3119 of 3119 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FinalGroundingAndDeglobalizing (Myoldmopar) - Win64-Windows-10-VisualStudio-16: OK (2328 of 2328 tests passed, 0 test warnings)

Build Badge Test Badge

@nrel-bot-2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FinalGroundingAndDeglobalizing (Myoldmopar) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (726 of 727 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 726
  • Timeout: 1

Build Badge Test Badge Coverage Badge

Please sign in to comment.