Ejemplo n.º 1
0
static void dealloc(xmlErrorPtr ptr)
{
  NOKOGIRI_DEBUG_START(ptr);
  xmlResetError(ptr);
  xmlFree(ptr);
  NOKOGIRI_DEBUG_END(ptr);
}
Ejemplo n.º 2
0
static void dealloc(xmlDocPtr doc)
{
  NOKOGIRI_DEBUG_START(doc);

  nokogiriTuplePtr tuple = doc->_private;
  xmlNodeSetPtr node_set = tuple->unlinkedNodes;

  int j ;
  for(j = 0 ; j < node_set->nodeNr ; j++) {
    xmlNodePtr node = node_set->nodeTab[j];
    switch(node->type)
    {
      case XML_ATTRIBUTE_NODE:
        xmlFreePropList(node);
        break;
      default:
        if(node->parent == NULL) {
          xmlAddChild((xmlNodePtr)doc, node);
        }
    }
  }

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

  free(doc->_private);
  doc->_private = NULL;
  xmlFreeDoc(doc);

  NOKOGIRI_DEBUG_END(doc);
}
Ejemplo n.º 3
0
static void dealloc(xmlDocPtr doc)
{
  NOKOGIRI_DEBUG_START(doc);

  nokogiriTuplePtr tuple = doc->_private;
  xmlNodeSetPtr node_set = tuple->unlinkedNodes;

  int j ;
  for(j = 0 ; j < node_set->nodeNr ; j++) {
    xmlNodePtr node = node_set->nodeTab[j];
    if (node->parent == NULL) {
      xmlAddChild((xmlNodePtr)doc, node);
    }
  }

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

  free(doc->_private);
  doc->_private = NULL;
  xmlFreeDoc(doc);

  NOKOGIRI_DEBUG_END(doc);
}
Ejemplo n.º 4
0
static void dealloc(xmlDocPtr doc)
{
    NOKOGIRI_DEBUG_START(doc);
    doc->_private = NULL;
    xmlFreeDoc(doc);
    NOKOGIRI_DEBUG_END(doc);
}
Ejemplo n.º 5
0
static void dealloc(xmlDocPtr doc)
{
  st_table *node_hash;

  NOKOGIRI_DEBUG_START(doc);

  node_hash  = DOC_UNLINKED_NODE_HASH(doc);

  st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
  st_free_table(node_hash);

  free(doc->_private);

  /* When both Nokogiri and libxml-ruby are loaded, make sure that all nodes
   * have their _private pointers cleared. This is to avoid libxml-ruby's
   * xmlDeregisterNode callback from accessing VALUE pointers from ruby's GC
   * free context, which can result in segfaults.
   */
  if (xmlDeregisterNodeDefaultValue)
    remove_private((xmlNodePtr)doc);

  xmlFreeDoc(doc);

  NOKOGIRI_DEBUG_END(doc);
}
Ejemplo n.º 6
0
static void deallocate(xmlParserCtxtPtr ctx)
{
  NOKOGIRI_DEBUG_START(ctx);
  if(ctx != NULL) {
    NOKOGIRI_SAX_TUPLE_DESTROY(ctx->userData);
    xmlFreeParserCtxt(ctx);
  }
  NOKOGIRI_DEBUG_END(ctx);
}
Ejemplo n.º 7
0
static void dealloc(nokogiriXsltStylesheetTuple *wrapper)
{
    xsltStylesheetPtr doc = wrapper->ss;

    NOKOGIRI_DEBUG_START(doc);
    xsltFreeStylesheet(doc); /* commented out for now. */
    NOKOGIRI_DEBUG_END(doc);
    
    free(wrapper);
}
static void deallocate(xmlParserCtxtPtr ctxt)
{
  NOKOGIRI_DEBUG_START(handler);

  ctxt->sax = NULL;

  xmlFreeParserCtxt(ctxt);

  NOKOGIRI_DEBUG_END(handler);
}
Ejemplo n.º 9
0
static void dealloc(xmlDocPtr doc)
{
    NOKOGIRI_DEBUG_START(doc);

    st_table *node_hash = DOC_UNLINKED_NODE_HASH(doc);

    xmlDeregisterNodeFunc func = xmlDeregisterNodeDefault(NULL);

    st_foreach(node_hash, dealloc_node_i, (st_data_t)doc);
    st_free_table(node_hash);

    free(doc->_private);
    doc->_private = NULL;
    xmlFreeDoc(doc);

    xmlDeregisterNodeDefault(func);

    NOKOGIRI_DEBUG_END(doc);
}
Ejemplo n.º 10
0
static void deallocate(xmlParserCtxtPtr ctx)
{
  NOKOGIRI_DEBUG_START(ctx);
  if(ctx != NULL) xmlFreeParserCtxt(ctx);
  NOKOGIRI_DEBUG_END(ctx);
}
static void deallocate(xmlXPathContextPtr ctx)
{
  NOKOGIRI_DEBUG_START(ctx);
  xmlXPathFreeContext(ctx);
  NOKOGIRI_DEBUG_END(ctx);
}
Ejemplo n.º 12
0
static void dealloc(xmlSchemaPtr schema)
{
  NOKOGIRI_DEBUG_START(schema);
  xmlSchemaFree(schema);
  NOKOGIRI_DEBUG_END(schema);
}
Ejemplo n.º 13
0
static void dealloc(xsltStylesheetPtr doc)
{
    NOKOGIRI_DEBUG_START(doc);
    xsltFreeStylesheet(doc); // commented out for now.
    NOKOGIRI_DEBUG_END(doc);
}
Ejemplo n.º 14
0
static void dealloc(xmlRelaxNGPtr schema)
{
  NOKOGIRI_DEBUG_START(schema);
  xmlRelaxNGFree(schema);
  NOKOGIRI_DEBUG_END(schema);
}
Ejemplo n.º 15
0
#include <xml_node.h>

static ID decorate, decorate_bang;

#ifdef DEBUG
static void debug_node_dealloc(xmlNodePtr x)
{
  NOKOGIRI_DEBUG_START(x)
  NOKOGIRI_DEBUG_END(x)
}
#else
#  define debug_node_dealloc 0
#endif

static void mark(xmlNodePtr node)
{
  rb_gc_mark(DOC_RUBY_OBJECT(node->doc));
}

/* :nodoc: */
typedef xmlNodePtr (*pivot_reparentee_func)(xmlNodePtr, xmlNodePtr);

/* :nodoc: */
static void relink_namespace(xmlNodePtr reparented)
{
  xmlNodePtr child;

  /* Avoid segv when relinking against unlinked nodes. */
  if(!reparented->parent) return;

  /* Make sure that our reparented node has the correct namespaces */
Ejemplo n.º 16
0
static void dealloc(xmlTextReaderPtr reader)
{
  NOKOGIRI_DEBUG_START(reader);
  xmlFreeTextReader(reader);
  NOKOGIRI_DEBUG_END(reader);
}
Ejemplo n.º 17
0
static void deallocate(xmlSAXHandlerPtr handler)
{
  NOKOGIRI_DEBUG_START(handler);
  free(handler);
  NOKOGIRI_DEBUG_END(handler);
}