mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-23 12:48:54 +00:00
log: deduplicate unescape_id from log_id
This commit is contained in:
parent
743df9f0f9
commit
f34c4f2e26
1 changed files with 3 additions and 9 deletions
|
@ -664,15 +664,9 @@ const char *log_const(const RTLIL::Const &value, bool autoint)
|
|||
|
||||
const char *log_id(const RTLIL::IdString &str)
|
||||
{
|
||||
log_id_cache.push_back(strdup(str.c_str()));
|
||||
const char *p = log_id_cache.back();
|
||||
if (p[0] != '\\')
|
||||
return p;
|
||||
if (p[1] == '$' || p[1] == '\\' || p[1] == 0)
|
||||
return p;
|
||||
if (p[1] >= '0' && p[1] <= '9')
|
||||
return p;
|
||||
return p+1;
|
||||
std::string unescaped = RTLIL::unescape_id(str);
|
||||
log_id_cache.push_back(strdup(unescaped.c_str()));
|
||||
return log_id_cache.back();
|
||||
}
|
||||
|
||||
const char *log_str(const char *str)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue