RegexpCompileError leak
This commit is contained in:
parent
2412dbbc0b
commit
5d6faea9e3
|
|
@ -16,6 +16,7 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -16,13 +16,8 @@
|
|||
|
||||
#include "PatternMatch.hh"
|
||||
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <ctype.h>
|
||||
#include <tcl.h>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
|
|
|||
Loading…
Reference in New Issue