Skip to content

Commit

Permalink
use fmt::format
Browse files Browse the repository at this point in the history
Signed-off-by: Cho Moon <[email protected]>
  • Loading branch information
precisionmoon committed Dec 11, 2024
1 parent 872843f commit 702b98f
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/rsz/src/Resizer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2422,7 +2422,7 @@ string Resizer::makeUniqueNetName()
Instance* top_inst = network_->topInstance();
do {
// sta::stringPrint can lead to string overflow and fatal
node_name = std::string("net") + std::to_string(unique_net_index_++);
node_name = fmt::format("net{}", unique_net_index_++);
} while (network_->findNet(top_inst, node_name.c_str()));
return node_name;
}
Expand All @@ -2445,10 +2445,9 @@ string Resizer::makeUniqueInstName(const char* base_name, bool underscore)
do {
// sta::stringPrint can lead to string overflow and fatal
if (underscore) {
inst_name = std::string(base_name) + std::string("_")
+ std::to_string(unique_inst_index_++);
inst_name = fmt::format("{}_{}", base_name, unique_inst_index_++);
} else {
inst_name = std::string(base_name) + std::to_string(unique_inst_index_++);
inst_name = fmt::format("{}{}", base_name, unique_inst_index_++);
}
} while (network_->findInstance(inst_name.c_str()));
return inst_name;
Expand Down

0 comments on commit 702b98f

Please sign in to comment.