[#62904] [ruby-trunk - Feature #9894] [Open] [RFC] README.EXT: document rb_gc_register_mark_object — normalperson@...
Issue #9894 has been reported by Eric Wong.
3 messages
2014/06/02
[#63321] [ANN] ElixirConf 2014 - Don't Miss Jos辿 Valim and Dave Thomas — Jim Freeze <jimfreeze@...>
Just a few more weeks until ElixirConf 2014!
6 messages
2014/06/24
[#63391] Access Modifiers (Internal Interfaces) — Daniel da Silva Ferreira <danieldasilvaferreira@...>
Hi,
3 messages
2014/06/28
[ruby-core:63281] [ruby-trunk - Feature #9863] [Closed] Hide Float internal
From:
shyouhei@...
Date:
2014-06-23 04:12:30 UTC
List:
ruby-core #63281
Issue #9863 has been updated by Shyouhei Urabe.
Status changed from Open to Closed
% Done changed from 0 to 100
Applied in changeset r46505.
----------
* include/ruby/ruby.h (struct RFloat): no longer. [Feature #9863]
* include/ruby/ruby.h (RFLOAT): ditto.
* internal.h (struct RFloat): moved here.
* internal.h (RFLOAT): ditto.
----------------------------------------
Feature #9863: Hide Float internal
https://bugs.ruby-lang.org/issues/9863#change-47329
* Author: Shyouhei Urabe
* Status: Closed
* Priority: Normal
* Assignee:
* Category: core
* Target version: current: 2.2.0
----------------------------------------
~~~Patch
From 93f013d689abed19f4223f968e374046437b7fa7 Mon Sep 17 00:00:00 2001
From: "Urabe, Shyouhei" <shyouhei@ruby-lang.org>
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 <shyouhei@ruby-lang.org>
---
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 <shyouhei@ruby-lang.org>
+
+ * include/ruby/ruby.h (struct RFloat): no longer.
+
+ * internal.h (struct RFloat): moved here.
+
Sun May 25 20:31:49 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* 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/