From 7a74cdbe4538e964023e5a0fdca58d8af708b91e Mon Sep 17 00:00:00 2001
From: Mike Dalessio <mike.dalessio@gmail.com>
Date: Thu, 29 Oct 2020 11:50:11 -0400
Subject: [PATCH 1/2] fix: avoid collision with glibc's canonicalize() method

Closes #2105
---
 ext/nokogiri/xml_document.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ext/nokogiri/xml_document.c b/ext/nokogiri/xml_document.c
index 3a8ba06e3e..6c010b5438 100644
--- a/ext/nokogiri/xml_document.c
+++ b/ext/nokogiri/xml_document.c
@@ -506,7 +506,7 @@ static int block_caller(void * ctx, xmlNodePtr _node, xmlNodePtr _parent)
  * The block must return a non-nil, non-false value if the +obj+ passed in
  * should be included in the canonicalized document.
  */
-static VALUE canonicalize(int argc, VALUE* argv, VALUE self)
+static VALUE nokogiri_xml_document_canonicalize(int argc, VALUE* argv, VALUE self)
 {
   VALUE mode;
   VALUE incl_ns;
@@ -587,7 +587,7 @@ void init_xml_document()
   rb_define_method(klass, "encoding", encoding, 0);
   rb_define_method(klass, "encoding=", set_encoding, 1);
   rb_define_method(klass, "version", version, 0);
-  rb_define_method(klass, "canonicalize", canonicalize, -1);
+  rb_define_method(klass, "canonicalize", nokogiri_xml_document_canonicalize, -1);
   rb_define_method(klass, "dup", duplicate_document, -1);
   rb_define_method(klass, "url", url, 0);
   rb_define_method(klass, "create_entity", create_entity, -1);
