diff options
Diffstat (limited to 'ext/ffi_c/compat.h')
-rw-r--r-- | ext/ffi_c/compat.h | 30 |
1 files changed, 8 insertions, 22 deletions
diff --git a/ext/ffi_c/compat.h b/ext/ffi_c/compat.h index 3f7bbae..856836f 100644 --- a/ext/ffi_c/compat.h +++ b/ext/ffi_c/compat.h @@ -32,26 +32,6 @@ #include <ruby.h> -#ifndef RARRAY_LEN -# define RARRAY_LEN(ary) RARRAY(ary)->len -#endif - -#ifndef RARRAY_PTR -# define RARRAY_PTR(ary) RARRAY(ary)->ptr -#endif - -#ifndef RSTRING_LEN -# define RSTRING_LEN(s) RSTRING(s)->len -#endif - -#ifndef RSTRING_PTR -# define RSTRING_PTR(s) RSTRING(s)->ptr -#endif - -#ifndef NUM2ULL -# define NUM2ULL(x) rb_num2ull((VALUE)x) -#endif - #ifndef roundup # define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) #endif @@ -75,8 +55,14 @@ # define MIN(a, b) ((a) < (b) ? (a) : (b)) #endif -#ifndef RB_GC_GUARD -# define RB_GC_GUARD(x) (x) + +#ifdef HAVE_RB_GC_MARK_MOVABLE +#define ffi_compact_callback(x) .dcompact = (x), +#define ffi_gc_location(x) x = rb_gc_location(x) +#else +#define rb_gc_mark_movable(x) rb_gc_mark(x) +#define ffi_compact_callback(x) +#define ffi_gc_location(x) #endif #endif /* RBFFI_COMPAT_H */ |