Skip to content

Commit

Permalink
Update callbacks to use compatible signatures
Browse files Browse the repository at this point in the history
Co-Authored-By: Matt Valentine-House <matt@eightbitraptor.com>
  • Loading branch information
tenderlove and eightbitraptor committed Jun 27, 2022
1 parent a520f47 commit 0fd5321
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions ext/nokogiri/xml_node.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ typedef xmlNodePtr(*pivot_reparentee_func)(xmlNodePtr, xmlNodePtr);

#ifdef DEBUG
static void
_xml_node_dealloc(xmlNodePtr x)
_xml_node_dealloc(void * _x)
{
xmlNodePtr x = (xmlNodePtr)_x;

NOKOGIRI_DEBUG_START(x)
NOKOGIRI_DEBUG_END(x)
}
Expand All @@ -27,8 +29,10 @@ get_document_for_node(xmlNodePtr c_node)
}

static void
_xml_node_mark(xmlNodePtr node)
_xml_node_mark(void * _node)
{
xmlNodePtr node = (xmlNodePtr)_node;

if(!DOC_RUBY_OBJECT_TEST(get_document_for_node(node))) {
return;
}
Expand All @@ -45,21 +49,21 @@ _xml_node_mark(xmlNodePtr node)

#ifdef HAVE_RB_GC_LOCATION
static void
_xml_node_update_references(xmlNodePtr node)
_xml_node_update_references(void * _node)
{
xmlNodePtr node = (xmlNodePtr)_node;

if (node->_private) {
node->_private = (void *)rb_gc_location((VALUE)node->_private);
}
}
#endif

typedef void (*gc_callback_t)(void *);

static const rb_data_type_t nokogiri_node_type = {
"Nokogiri/XMLNode",
{(gc_callback_t)_xml_node_mark, (gc_callback_t)_xml_node_dealloc, 0,
{_xml_node_mark, _xml_node_dealloc, 0,
#ifdef HAVE_RB_GC_LOCATION
(gc_callback_t)_xml_node_update_references
_xml_node_update_references
#endif
},
0, 0,
Expand Down

0 comments on commit 0fd5321

Please sign in to comment.