Skip to content

Commit

Permalink
Define rb_class_attached_object for older versions of Ruby.
Browse files Browse the repository at this point in the history
  • Loading branch information
cfis committed Jan 7, 2024
1 parent 63a542f commit 2c997a0
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ext/ruby_prof/rp_method.c
Expand Up @@ -6,6 +6,16 @@
#include "rp_method.h"
#include "rp_profile.h"

#include <ruby/version.h>

// Needed for Ruby 3.0.* and 3.1.*
#if RUBY_API_VERSION_MAJOR == 3 && RUBY_API_VERSION_MINOR < 2
VALUE rb_class_attached_object(VALUE klass)
{
return rb_iv_get(klass, "__attached__");
}
#endif

VALUE cRpMethodInfo;

/* ================ Helper Functions =================*/
Expand Down

0 comments on commit 2c997a0

Please sign in to comment.