Fixed memory corruption related to id2cstr()
authorClifford Wolf <clifford@clifford.at>
Sat, 2 Aug 2014 11:34:07 +0000 (13:34 +0200)
committerClifford Wolf <clifford@clifford.at>
Sat, 2 Aug 2014 11:34:07 +0000 (13:34 +0200)
kernel/rtlil.h

index 70e01b72108c1a8fcce174d299d5ceccbb40d750..daf888b7942defa6e9785d0e378f294c6e720031 100644 (file)
@@ -121,7 +121,7 @@ namespace RTLIL
                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] != '$')
                        return str.c_str() + 1;
                return str.c_str();
@@ -131,7 +131,7 @@ namespace RTLIL
                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());
        }