filter null checks

Signed-off-by: James Cherry <cherry@parallaxsw.com>
This commit is contained in:
James Cherry 2023-07-05 12:40:56 -07:00
parent 099936561d
commit c8c98c76ea
1 changed files with 46 additions and 40 deletions

View File

@ -2495,8 +2495,9 @@ filter_ports(const char *property,
const char *pattern, const char *pattern,
PortSeq *ports) PortSeq *ports)
{ {
Sta *sta = Sta::sta();
PortSeq filtered_ports; PortSeq filtered_ports;
if (ports) {
Sta *sta = Sta::sta();
bool exact_match = stringEq(op, "=="); bool exact_match = stringEq(op, "==");
bool pattern_match = stringEq(op, "=~"); bool pattern_match = stringEq(op, "=~");
bool not_match = stringEq(op, "!="); bool not_match = stringEq(op, "!=");
@ -2510,6 +2511,7 @@ filter_ports(const char *property,
filtered_ports.push_back(port); filtered_ports.push_back(port);
} }
delete ports; delete ports;
}
return filtered_ports; return filtered_ports;
} }
@ -2519,12 +2521,13 @@ filter_insts(const char *property,
const char *pattern, const char *pattern,
InstanceSeq *insts) InstanceSeq *insts)
{ {
InstanceSeq filtered_insts;
if (insts) {
Sta *sta = Sta::sta(); Sta *sta = Sta::sta();
cmdLinkedNetwork(); cmdLinkedNetwork();
bool exact_match = stringEq(op, "=="); bool exact_match = stringEq(op, "==");
bool pattern_match = stringEq(op, "=~"); bool pattern_match = stringEq(op, "=~");
bool not_match = stringEq(op, "!="); bool not_match = stringEq(op, "!=");
InstanceSeq filtered_insts;
for (const Instance *inst : *insts) { for (const Instance *inst : *insts) {
PropertyValue value(getProperty(inst, property, sta)); PropertyValue value(getProperty(inst, property, sta));
const char *prop = value.stringValue(); const char *prop = value.stringValue();
@ -2535,6 +2538,7 @@ filter_insts(const char *property,
filtered_insts.push_back(inst); filtered_insts.push_back(inst);
} }
delete insts; delete insts;
}
return filtered_insts; return filtered_insts;
} }
@ -2544,8 +2548,9 @@ filter_pins(const char *property,
const char *pattern, const char *pattern,
PinSeq *pins) PinSeq *pins)
{ {
Sta *sta = Sta::sta();
PinSeq filtered_pins; PinSeq filtered_pins;
if (pins) {
Sta *sta = Sta::sta();
bool exact_match = stringEq(op, "=="); bool exact_match = stringEq(op, "==");
bool pattern_match = stringEq(op, "=~"); bool pattern_match = stringEq(op, "=~");
bool not_match = stringEq(op, "!="); bool not_match = stringEq(op, "!=");
@ -2559,6 +2564,7 @@ filter_pins(const char *property,
filtered_pins.push_back(pin); filtered_pins.push_back(pin);
} }
delete pins; delete pins;
}
return filtered_pins; return filtered_pins;
} }