mirror of
https://github.com/YosysHQ/yosys
synced 2025-07-24 21:27:00 +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)
|
const char *log_id(const RTLIL::IdString &str)
|
||||||
{
|
{
|
||||||
log_id_cache.push_back(strdup(str.c_str()));
|
std::string unescaped = RTLIL::unescape_id(str);
|
||||||
const char *p = log_id_cache.back();
|
log_id_cache.push_back(strdup(unescaped.c_str()));
|
||||||
if (p[0] != '\\')
|
return log_id_cache.back();
|
||||||
return p;
|
|
||||||
if (p[1] == '$' || p[1] == '\\' || p[1] == 0)
|
|
||||||
return p;
|
|
||||||
if (p[1] >= '0' && p[1] <= '9')
|
|
||||||
return p;
|
|
||||||
return p+1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *log_str(const char *str)
|
const char *log_str(const char *str)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue