Skip to content

Commit

Permalink
Reverting a portion of 2675a75
Browse files Browse the repository at this point in the history
to stop freeing the namespace nodes when the NodeSet is GCed.

Related to #1155
  • Loading branch information
flavorjones committed Oct 1, 2015
1 parent 409379b commit 395557b
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions ext/nokogiri/xml_node_set.c
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,10 @@ static void deallocate(nokogiriNodeSetTuple *tuple)
return;

NOKOGIRI_DEBUG_START(node_set) ;
st_foreach(tuple->namespaces, dealloc_namespace, 0);

if (node_set->nodeTab != NULL)
xmlFree(node_set->nodeTab);

xmlFree(node_set);
st_free_table(tuple->namespaces);
free(tuple);
NOKOGIRI_DEBUG_END(node_set) ;
}
Expand Down Expand Up @@ -420,24 +417,12 @@ VALUE Nokogiri_wrap_xml_node_set(xmlNodeSetPtr node_set, VALUE document)
deallocate, tuple);

tuple->node_set = node_set;
tuple->namespaces = st_init_numtable();

if (!NIL_P(document)) {
rb_iv_set(new_set, "@document", document);
rb_funcall(document, decorate, 1, new_set);
}

if (node_set && node_set->nodeTab) {
for (i = 0; i < node_set->nodeNr; i++) {
cur = node_set->nodeTab[i];
if (cur && cur->type == XML_NAMESPACE_DECL) {
ns = (xmlNsPtr)cur;
if (ns->next && ns->next->type != XML_NAMESPACE_DECL)
st_insert(tuple->namespaces, (st_data_t)cur, (st_data_t)0);
}
}
}

return new_set ;
}

Expand Down

0 comments on commit 395557b

Please sign in to comment.