Fixed memory corruption related to id2cstr()

This commit is contained in:
Clifford Wolf 2014-08-02 13:34:07 +02:00
parent b9bd22b8c8
commit 97ad0623df
1 changed files with 2 additions and 2 deletions

View File

@ -121,7 +121,7 @@ namespace RTLIL
return str; return str;
} }
static inline const char *id2cstr(std::string str) { static inline const char *id2cstr(const std::string &str) {
if (str.size() > 1 && str[0] == '\\' && str[1] != '$') if (str.size() > 1 && str[0] == '\\' && str[1] != '$')
return str.c_str() + 1; return str.c_str() + 1;
return str.c_str(); return str.c_str();
@ -131,7 +131,7 @@ namespace RTLIL
return unescape_id(str.str()); return unescape_id(str.str());
} }
static inline const char *id2cstr(RTLIL::IdString str) { static inline const char *id2cstr(const RTLIL::IdString &str) {
return id2cstr(str.str()); return id2cstr(str.str());
} }