<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -296,12 +296,15 @@ VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc)
       dealloc,
       doc
   );
+
+  VALUE cache = rb_ary_new();
   rb_iv_set(rb_doc, &quot;@decorators&quot;, Qnil);
-  rb_iv_set(rb_doc, &quot;@node_cache&quot;, rb_ary_new());
+  rb_iv_set(rb_doc, &quot;@node_cache&quot;, cache);
   rb_funcall(rb_doc, rb_intern(&quot;initialize&quot;), 0);
 
   tuple-&gt;doc = (void *)rb_doc;
   tuple-&gt;unlinkedNodes = xmlXPathNodeSetCreate(NULL);
+  tuple-&gt;node_cache = cache;
   doc-&gt;_private = tuple ;
 
   return rb_doc ;</diff>
      <filename>ext/nokogiri/xml_document.c</filename>
    </modified>
    <modified>
      <diff>@@ -6,6 +6,7 @@
 struct _nokogiriTuple {
   xmlDocPtr     doc;
   xmlNodeSetPtr unlinkedNodes;
+  VALUE         node_cache;
 };
 typedef struct _nokogiriTuple nokogiriTuple;
 typedef nokogiriTuple * nokogiriTuplePtr;
@@ -16,6 +17,7 @@ VALUE Nokogiri_wrap_xml_document(VALUE klass, xmlDocPtr doc);
 #define DOC_RUBY_OBJECT_TEST(x) ((nokogiriTuplePtr)(x-&gt;_private))
 #define DOC_RUBY_OBJECT(x) ((VALUE)((nokogiriTuplePtr)(x-&gt;_private))-&gt;doc)
 #define DOC_UNLINKED_NODE_SET(x) ((xmlNodeSetPtr)((nokogiriTuplePtr)(x-&gt;_private))-&gt;unlinkedNodes)
+#define DOC_NODE_CACHE(x) ((VALUE)((nokogiriTuplePtr)(x-&gt;_private))-&gt;node_cache)
 
 extern VALUE cNokogiriXmlDocument ;
 #endif</diff>
      <filename>ext/nokogiri/xml_document.h</filename>
    </modified>
    <modified>
      <diff>@@ -857,7 +857,7 @@ VALUE Nokogiri_wrap_xml_node(VALUE klass, xmlNodePtr node)
 
   if (DOC_RUBY_OBJECT_TEST(node-&gt;doc) &amp;&amp; DOC_RUBY_OBJECT(node-&gt;doc)) {
     document = DOC_RUBY_OBJECT(node-&gt;doc);
-    node_cache = rb_iv_get(document, &quot;@node_cache&quot;);
+    node_cache = DOC_NODE_CACHE(node-&gt;doc);
   }
 
   rb_ary_push(node_cache, rb_node);</diff>
      <filename>ext/nokogiri/xml_node.c</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>926b881c7f20d5f17c80c451451151501656609f</id>
    </parent>
  </parents>
  <author>
    <name>Aaron Patterson</name>
    <email>aaron.patterson@gmail.com</email>
  </author>
  <url>http://github.com/tenderlove/nokogiri/commit/b69649bf6ca39b7eea3476f7d9fa2828ec74ea5a</url>
  <id>b69649bf6ca39b7eea3476f7d9fa2828ec74ea5a</id>
  <committed-date>2009-06-21T20:48:15-07:00</committed-date>
  <authored-date>2009-06-21T20:48:15-07:00</authored-date>
  <message>adding node cache to tuple</message>
  <tree>5599a1c47ffea70f2beb570ffeeb2201069e9d8f</tree>
  <committer>
    <name>Aaron Patterson</name>
    <email>aaron.patterson@gmail.com</email>
  </committer>
</commit>
