diff options
author | Alberto Gonzalez <boqwxp@airmail.cc> | 2020-04-09 19:31:12 +0000 |
---|---|---|
committer | Alberto Gonzalez <boqwxp@airmail.cc> | 2020-04-16 18:56:50 +0000 |
commit | b94f38295a6ca30e46b1d404953c7f5f3761734e (patch) | |
tree | 0339366e225fba3d919027fd1f7ef6f898a458e6 | |
parent | 6081c1bbd3e21ed67ceb12171f6f33d6ec988217 (diff) | |
download | yosys-b94f38295a6ca30e46b1d404953c7f5f3761734e.tar.gz yosys-b94f38295a6ca30e46b1d404953c7f5f3761734e.tar.bz2 yosys-b94f38295a6ca30e46b1d404953c7f5f3761734e.zip |
Revert to `stringf()` rather than stringstreams.
-rw-r--r-- | passes/cmds/rename.cc | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/passes/cmds/rename.cc b/passes/cmds/rename.cc index 8c5450a67..afc23b0a1 100644 --- a/passes/cmds/rename.cc +++ b/passes/cmds/rename.cc @@ -258,22 +258,18 @@ struct RenamePass : public Pass { for (auto wire : module->selected_wires()) if (wire->name[0] == '$') { - std::ostringstream buf; - do { - buf.str(""); - buf << "\\" << pattern_prefix << counter++ << pattern_suffix; - } while (module->count_id(buf.str()) > 0); - new_wire_names[wire] = buf.str(); + RTLIL::IdString buf; + do buf = stringf("\\%s%d%s", pattern_prefix.c_str(), counter++, pattern_suffix.c_str()); + while (module->wire(buf) != nullptr); + new_wire_names[wire] = buf; } for (auto cell : module->selected_cells()) if (cell->name[0] == '$') { - std::ostringstream buf; - do { - buf.str(""); - buf << "\\" << pattern_prefix << counter++ << pattern_suffix; - } while (module->count_id(buf.str()) > 0); - new_cell_names[cell] = buf.str(); + RTLIL::IdString buf; + do buf = stringf("\\%s%d%s", pattern_prefix.c_str(), counter++, pattern_suffix.c_str()); + while (module->cell(buf) != nullptr); + new_cell_names[cell] = buf; } for (auto &it : new_wire_names) |