Skip to content

Commit

Permalink
Merge pull request #2506 from mgreter/3.4-stable
Browse files Browse the repository at this point in the history
Fix memory leak by removing previously unused code
  • Loading branch information
mgreter authored Nov 13, 2017
2 parents 8ea0ad8 + 200ae6c commit c943792
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 20 deletions.
22 changes: 9 additions & 13 deletions src/eval.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1767,7 +1767,7 @@ namespace Sass {
Complex_Selector_Ptr is = resolved->at(i)->first();
while (is) {
if (is->head()) {
is->head()->perform(this);
is->head(operator()(is->head()));
}
is = is->tail();
}
Expand All @@ -1779,21 +1779,13 @@ namespace Sass {
{
for (size_t i = 0; i < s->length(); i++) {
Simple_Selector_Ptr ss = s->at(i);
if (ss) ss->perform(this);
// skip parents here (called via resolve_parent_refs)
if (ss == NULL || Cast<Parent_Selector>(ss)) continue;
s->at(i) = Cast<Simple_Selector>(ss->perform(this));
}
return s;
}

// XXX: this is never hit via spec tests
Attribute_Selector_Ptr Eval::operator()(Attribute_Selector_Ptr s)
{
String_Obj attr = s->value();
if (attr) { attr = static_cast<String_Ptr>(attr->perform(this)); }
Attribute_Selector_Ptr ss = SASS_MEMORY_COPY(s);
ss->value(attr);
return ss;
}

Selector_List_Ptr Eval::operator()(Selector_Schema_Ptr s)
{
LOCAL_FLAG(is_in_selector_schema, true);
Expand Down Expand Up @@ -1841,6 +1833,11 @@ namespace Sass {
}
}

Simple_Selector_Ptr Eval::operator()(Simple_Selector_Ptr s)
{
return s;
}

// hotfix to avoid invalid nested `:not` selectors
// probably the wrong place, but this should ultimately
// be fixed by implement superselector correctly for `:not`
Expand Down Expand Up @@ -1872,7 +1869,6 @@ namespace Sass {
}
}
}

return s;
};

Expand Down
14 changes: 7 additions & 7 deletions src/eval.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,14 +76,14 @@ namespace Sass {
Selector_List_Ptr operator()(Selector_List_Ptr);
Selector_List_Ptr operator()(Complex_Selector_Ptr);
Compound_Selector_Ptr operator()(Compound_Selector_Ptr);
Attribute_Selector_Ptr operator()(Attribute_Selector_Ptr);
// they don't have any specific implementatio (yet)
Element_Selector_Ptr operator()(Element_Selector_Ptr s) { return s; };
Pseudo_Selector_Ptr operator()(Pseudo_Selector_Ptr s) { return s; };
Simple_Selector_Ptr operator()(Simple_Selector_Ptr s);
Wrapped_Selector_Ptr operator()(Wrapped_Selector_Ptr s);
Class_Selector_Ptr operator()(Class_Selector_Ptr s) { return s; };
Id_Selector_Ptr operator()(Id_Selector_Ptr s) { return s; };
Placeholder_Selector_Ptr operator()(Placeholder_Selector_Ptr s) { return s; };
// they don't have any specific implementation (yet)
// Element_Selector_Ptr operator()(Element_Selector_Ptr s) { return s; };
// Pseudo_Selector_Ptr operator()(Pseudo_Selector_Ptr s) { return s; };
// Class_Selector_Ptr operator()(Class_Selector_Ptr s) { return s; };
// Id_Selector_Ptr operator()(Id_Selector_Ptr s) { return s; };
// Placeholder_Selector_Ptr operator()(Placeholder_Selector_Ptr s) { return s; };
// actual evaluated selectors
Selector_List_Ptr operator()(Selector_Schema_Ptr);
Expression_Ptr operator()(Parent_Selector_Ptr);
Expand Down

0 comments on commit c943792

Please sign in to comment.