Revert to `stringf()` rather than stringstreams.
authorAlberto Gonzalez <boqwxp@airmail.cc>
Thu, 9 Apr 2020 19:31:12 +0000 (19:31 +0000)
committerAlberto Gonzalez <boqwxp@airmail.cc>
Thu, 16 Apr 2020 18:56:50 +0000 (18:56 +0000)
passes/cmds/rename.cc

index 8c5450a673caaeeec17a9af82a471965c4cc1438..afc23b0a1e1a6a284cf9014552b656d9cd934cf6 100644 (file)
@@ -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)