ext/fiddle/memory_view.c in fiddle-1.0.9 vs ext/fiddle/memory_view.c in fiddle-1.1.0
- old
+ new
@@ -1,13 +1,14 @@
+#include <fiddle.h>
+
+#ifdef HAVE_RUBY_MEMORY_VIEW_H
+
#include <stdbool.h>
#include <ruby/ruby.h>
#include <ruby/encoding.h>
+#include <ruby/memory_view.h>
-#ifdef HAVE_RUBY_MEMORY_VIEW_H
-# include <ruby/memory_view.h>
-#endif
-
#if SIZEOF_INTPTR_T == SIZEOF_LONG_LONG
# define INTPTR2NUM LL2NUM
# define UINTPTR2NUM ULL2NUM
#elif SIZEOF_INTPTR_T == SIZEOF_LONG
# define INTPTR2NUM LONG2NUM
@@ -15,13 +16,10 @@
#else
# define INTPTR2NUM INT2NUM
# define UINTPTR2NUM UINT2NUM
#endif
-#include <fiddle.h>
-
-#ifdef FIDDLE_MEMORY_VIEW
VALUE rb_cMemoryView = Qnil;
struct memview_data {
rb_memory_view_t view;
rb_memory_view_item_component_t *members;
@@ -318,6 +316,6 @@
rb_define_method(rb_cMemoryView, "sub_offsets", rb_fiddle_memview_get_sub_offsets, 0);
rb_define_method(rb_cMemoryView, "[]", rb_fiddle_memview_aref, -1);
rb_define_method(rb_cMemoryView, "to_s", rb_fiddle_memview_to_s, 0);
}
-#endif /* FIDDLE_MEMORY_VIEW */
+#endif /* HAVE_RUBY_MEMORY_VIEW_H */