Skip to content

Commit

Permalink
Avoid ANYARGS deprecation warning on modern Rubies
Browse files Browse the repository at this point in the history
Rather than using rb_define_global_function, use
rb_define_module_function to define the RE2 method on Kernel, avoiding a
deprecation warning from
https://github.com/ruby/ruby/blob/ec37636ab36af36155faa4dbcfebaa161dcf394d/include/ruby/backward/cxxanyargs.hpp.
  • Loading branch information
mudge committed Sep 18, 2023
1 parent e6a52e6 commit 9f93070
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ext/re2/re2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1853,7 +1853,7 @@ void Init_re2(void) {
rb_define_singleton_method(re2_cRegexp, "compile",
RUBY_METHOD_FUNC(rb_class_new_instance), -1);

rb_define_global_function("RE2", RUBY_METHOD_FUNC(re2_re2), -1);
rb_define_module_function(rb_mKernel, "RE2", RUBY_METHOD_FUNC(re2_re2), -1);

/* Create the symbols used in options. */
id_utf8 = rb_intern("utf8");
Expand Down

0 comments on commit 9f93070

Please sign in to comment.