diff --git a/include/sta/PatternMatch.hh b/include/sta/PatternMatch.hh index bfd265c2..708e8686 100644 --- a/include/sta/PatternMatch.hh +++ b/include/sta/PatternMatch.hh @@ -16,6 +16,7 @@ #pragma once +#include #include "DisallowCopyAssign.hh" #include "Error.hh" @@ -67,12 +68,12 @@ private: class RegexpCompileError : public Exception { public: - explicit RegexpCompileError(const char *error); + explicit RegexpCompileError(const char *pattern); virtual ~RegexpCompileError() noexcept {} virtual const char *what() const noexcept; private: - const char *error_; + std::string error_; }; // Simple pattern match diff --git a/util/PatternMatch.cc b/util/PatternMatch.cc index d5e9c4c7..c8cb1ce0 100644 --- a/util/PatternMatch.cc +++ b/util/PatternMatch.cc @@ -16,13 +16,8 @@ #include "PatternMatch.hh" -#include -#include -#include #include -#include "StringUtil.hh" - namespace sta { using std::string; @@ -117,13 +112,15 @@ PatternMatch::matchNoCase(const char *str) const RegexpCompileError::RegexpCompileError(const char *pattern) : Exception() { - error_ = stringPrint("TCL failed to compile regular expression '%s'.", pattern); + error_ = "TCL failed to compile regular expression '"; + error_ += pattern; + error_ =+ "'."; } const char * RegexpCompileError::what() const noexcept { - return error_; + return error_.c_str(); } ////////////////////////////////////////////////////////////////