Skip to content

Commit

Permalink
just return the ruby object of node if one exists
Browse files Browse the repository at this point in the history
the fix in the previous commit is overly complicated. the if conditional
originaly tested whether the passed document has a ruby object in
'_private' which is unnecessary since we return the node's ruby object
if one exists. This commit moves the conditional to the beginning of the
function and simplifies it.a new object will be created and attach to
the document, otherwise.
  • Loading branch information
jvshahid committed Dec 9, 2015
1 parent b5c179a commit 743058a
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ext/nokogiri/xml_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,10 @@ static VALUE href(VALUE self)
VALUE Nokogiri_wrap_xml_namespace(xmlDocPtr doc, xmlNsPtr node)
{
VALUE ns, document, node_cache;
nokogiriTuplePtr node_has_a_document;

if (doc->type == XML_DOCUMENT_FRAG_NODE) doc = doc->doc;
node_has_a_document = DOC_RUBY_OBJECT_TEST(doc);
if (node->_private) return (VALUE)node->_private;

if(node->_private && node_has_a_document)
return (VALUE)node->_private;
if (doc->type == XML_DOCUMENT_FRAG_NODE) doc = doc->doc;

ns = Data_Wrap_Struct(cNokogiriXmlNamespace, 0, 0, node);

Expand Down

0 comments on commit 743058a

Please sign in to comment.