read_saif leak
Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
parent
058685adb5
commit
a4e6bed7d1
|
|
@ -175,8 +175,8 @@ SaifReader::setNetDurations(const char *net_name,
|
||||||
if (in_scope_level_ > 0) {
|
if (in_scope_level_ > 0) {
|
||||||
Instance *parent = path_.empty() ? network_->topInstance() : path_.back();
|
Instance *parent = path_.empty() ? network_->topInstance() : path_.back();
|
||||||
if (parent) {
|
if (parent) {
|
||||||
const char *net_name1 = unescaped(net_name);
|
string unescaped_name = unescaped(net_name);
|
||||||
const Pin *pin = sdc_network_->findPin(parent, net_name1);
|
const Pin *pin = sdc_network_->findPin(parent, unescaped_name.c_str());
|
||||||
if (pin) {
|
if (pin) {
|
||||||
double t1 = durations[static_cast<int>(SaifState::T1)];
|
double t1 = durations[static_cast<int>(SaifState::T1)];
|
||||||
float duty = t1 / duration_;
|
float duty = t1 / duration_;
|
||||||
|
|
@ -195,28 +195,22 @@ SaifReader::setNetDurations(const char *net_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
stringDelete(net_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
string
|
||||||
SaifReader::unescaped(const char *token)
|
SaifReader::unescaped(const char *token)
|
||||||
{
|
{
|
||||||
char *unescaped = new char[strlen(token) + 1];
|
string unescaped;
|
||||||
char *u = unescaped;
|
for (const char *t = token; *t; t++) {
|
||||||
size_t token_length = strlen(token);
|
char ch = *t;
|
||||||
|
if (ch == escape_)
|
||||||
for (size_t i = 0; i < token_length; i++) {
|
unescaped += *(t+1);
|
||||||
char ch = token[i];
|
|
||||||
if (ch == escape_) {
|
|
||||||
char next_ch = token[i + 1];
|
|
||||||
*u++ = next_ch;
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
// Just the normal noises.
|
// Just the normal noises.
|
||||||
*u++ = ch;
|
unescaped += ch;
|
||||||
}
|
}
|
||||||
*u = '\0';
|
debugPrint(debug_, "saif_name", 1, "token %s -> %s", token, unescaped.c_str());
|
||||||
debugPrint(debug_, "saif_name", 1, "token %s -> %s", token, unescaped);
|
|
||||||
return unescaped;
|
return unescaped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -84,7 +84,7 @@ public:
|
||||||
void notSupported(const char *feature);
|
void notSupported(const char *feature);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char *unescaped(const char *token);
|
string unescaped(const char *token);
|
||||||
|
|
||||||
const char *filename_;
|
const char *filename_;
|
||||||
const char *scope_; // Divider delimited scope to begin annotation.
|
const char *scope_; // Divider delimited scope to begin annotation.
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue