From: shyouhei@... Date: 2014-05-25T12:38:36+00:00 Subject: [ruby-core:62748] [ruby-trunk - Feature #9863] [Open] Hide Float internal Issue #9863 has been reported by Shyouhei Urabe. ---------------------------------------- Feature #9863: Hide Float internal https://bugs.ruby-lang.org/issues/9863 * Author: Shyouhei Urabe * Status: Open * Priority: Normal * Assignee: * Category: core * Target version: current: 2.2.0 ---------------------------------------- ~~~Patch From 93f013d689abed19f4223f968e374046437b7fa7 Mon Sep 17 00:00:00 2001 From: "Urabe, Shyouhei" Date: Sun, 25 May 2014 21:28:12 +0900 Subject: [PATCH] Hide Float internal I'd like to make `struct RFloat` opaque. We already have flonum. Looking into struct RFloat's internals have (I believe) zero use. The struct is already accessed via appropriate macros/functions so hiding it is super-duper easy (see the patch). Passes test-all. Signed-off-by: Urabe, Shyouhei --- ChangeLog | 6 ++++++ include/ruby/ruby.h | 6 +----- internal.h | 7 +++++++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7cc6e5b..3462eea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sun May 25 21:12:15 2014 URABE Shyouhei + + * include/ruby/ruby.h (struct RFloat): no longer. + + * internal.h (struct RFloat): moved here. + Sun May 25 20:31:49 2014 Nobuyoshi Nakada * configure.in (ac_cv_func_{getcontext,setcontext}): do not diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index a39b958..e99b6db 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -807,10 +807,7 @@ struct RClass { #define RMODULE_IS_REFINEMENT FL_USER3 #define RMODULE_INCLUDED_INTO_REFINEMENT FL_USER4 -struct RFloat { - struct RBasic basic; - double float_value; -}; +struct RFloat; double rb_float_value(VALUE); VALUE rb_float_new(double); @@ -1083,7 +1080,6 @@ struct RStruct { #define ROBJECT(obj) (R_CAST(RObject)(obj)) #define RCLASS(obj) (R_CAST(RClass)(obj)) #define RMODULE(obj) RCLASS(obj) -#define RFLOAT(obj) (R_CAST(RFloat)(obj)) #define RSTRING(obj) (R_CAST(RString)(obj)) #define RREGEXP(obj) (R_CAST(RRegexp)(obj)) #define RARRAY(obj) (R_CAST(RArray)(obj)) diff --git a/internal.h b/internal.h index 071f3ed..bd2c4fd 100644 --- a/internal.h +++ b/internal.h @@ -412,6 +412,13 @@ struct RRational { #define RRATIONAL(obj) (R_CAST(RRational)(obj)) +struct RFloat { + struct RBasic basic; + double float_value; +}; + +#define RFLOAT(obj) (R_CAST(RFloat)(obj)) + /* class.c */ void rb_class_subclass_add(VALUE super, VALUE klass); void rb_class_remove_from_super_subclasses(VALUE); -- 1.9.1 ~~~ -- https://bugs.ruby-lang.org/