Skip to content

Commit 4069d33

Browse files
authored
Merge pull request #8456 from The-OpenROAD-Project-staging/secure-coverity-fix
Fixed coverity issue.
2 parents ec03ada + c747e1f commit 4069d33

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

src/dbSta/src/dbEditHierarchy.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -593,24 +593,22 @@ void dbEditHierarchy::cleanUnusedHierPins(
593593
}
594594

595595
std::string dbEditHierarchy::makeUniqueName(dbModule* module,
596-
std::string name,
596+
std::string_view name,
597597
const char* io_type_str) const
598598
{
599-
std::string base_name = name;
599+
std::string base_name;
600600
if (io_type_str) {
601601
base_name = fmt::format("{}_{}", name, io_type_str);
602+
} else {
603+
base_name = name;
602604
}
603605

604606
std::string unique_name = base_name;
605607
int id = 0;
606608
while (module->findModBTerm(unique_name.c_str())
607609
|| module->getModNet(unique_name.c_str())) {
608610
id++;
609-
if (io_type_str) {
610-
unique_name = fmt::format("{}_{}_{}", name, io_type_str, id);
611-
} else {
612-
unique_name = fmt::format("{}_{}", base_name, id);
613-
}
611+
unique_name = fmt::format("{}_{}", base_name, id);
614612
}
615613
return unique_name;
616614
}

src/dbSta/src/dbEditHierarchy.hh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ class dbEditHierarchy
6363
dbModITerm*& top_mod_iterm) const;
6464
void reassociatePinConnection(Pin* pin);
6565
std::string makeUniqueName(dbModule* module,
66-
std::string name,
66+
std::string_view name,
6767
const char* io_type_str = nullptr) const;
6868

6969
// During the addition of new ports and new wiring we may

0 commit comments

Comments
 (0)