use std::string instead of stringPrint

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2024-08-16 17:09:58 -07:00
parent 61a607c68b
commit cb6922d743
2 changed files with 18 additions and 20 deletions

View File

@ -1034,8 +1034,9 @@ Pin *
SdfReader::findPin(const char *name)
{
if (path_) {
string path_name;
stringPrint(path_name, "%s%c%s", path_, divider_, name);
string path_name = path_;
path_name += divider_;
path_name += name;
Pin *pin = network_->findPin(path_name.c_str());
return pin;
}
@ -1046,9 +1047,14 @@ SdfReader::findPin(const char *name)
Instance *
SdfReader::findInstance(const char *name)
{
string inst_name = name;
if (path_)
stringPrint(inst_name, "%s%c%s", path_, divider_, name);
string inst_name;
if (path_) {
inst_name = path_;
inst_name += divider_;
inst_name += name;
}
else
inst_name = name;
Instance *inst = network_->findInstance(inst_name.c_str());
if (inst == nullptr)
sdfWarn(195, "instance %s not found.", inst_name.c_str());

View File

@ -713,13 +713,9 @@ getProperty(const LibertyCell *cell,
else if (stringEqual(property, "full_name")) {
auto network = sta->cmdNetwork();
auto lib = cell->libertyLibrary();
const char *lib_name = lib->name();
const char *cell_name = cell->name();
string full_name;
stringPrint(full_name, "%s%c%s",
lib_name,
network->pathDivider(),
cell_name);
string lib_name = lib->name();
string cell_name = cell->name();
string full_name = lib_name + network->pathDivider() + cell_name;
return PropertyValue(full_name);
}
else if (stringEqual(property, "filename"))
@ -748,14 +744,10 @@ getProperty(const Cell *cell,
|| stringEqual(property, "base_name"))
return PropertyValue(network->name(cell));
else if (stringEqual(property, "full_name")) {
auto lib = network->library(cell);
const char *lib_name = network->name(lib);
const char *cell_name = network->name(cell);
string full_name;
stringPrint(full_name, "%s%c%s",
lib_name,
network->pathDivider(),
cell_name);
Library *lib = network->library(cell);
string lib_name = network->name(lib);
string cell_name = network->name(cell);
string full_name = lib_name + network->pathDivider() + cell_name;
return PropertyValue(full_name);
}
else if (stringEqual(property, "library"))