aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-13 11:34:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-06-13 11:34:56 +0000
commitb070762a9e7d7594af03c7efa68d6593f3e60e55 (patch)
tree26c5f7135a20e184d000c238d6e52184f7ad6721 /include
parent10fb06aa8bf08177eb5c31fa45374c573a84a22a (diff)
downloadruby-b070762a9e7d7594af03c7efa68d6593f3e60e55.tar.gz
Integer unification macro
* include/ruby/ruby.h (RUBY_INTEGER_UNIFICATION): macro to tell if Integer is integrated. [ruby-core:75718][Bug #12427] * include/ruby/backward.h, internal.h (rb_cFixnum, rb_cBignum): fallback to rb_cInteger. * bignum.c, numeric.c, ext/json/generator/generator.{c,h}: use the macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55394 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'include')
-rw-r--r--include/ruby/backward.h5
-rw-r--r--include/ruby/ruby.h5
2 files changed, 10 insertions, 0 deletions
diff --git a/include/ruby/backward.h b/include/ruby/backward.h
index 4574cb98da..5fe88a2725 100644
--- a/include/ruby/backward.h
+++ b/include/ruby/backward.h
@@ -17,4 +17,9 @@ ruby_show_copyright_to_die(int exitcode)
(exit(ruby_show_copyright_to_die(EXIT_SUCCESS)))
#endif
+#ifdef RUBY_INTEGER_UNIFICATION
+# define rb_cFixnum rb_cInteger
+# define rb_cBignum rb_cInteger
+#endif
+
#endif /* RUBY_RUBY_BACKWARD_H */
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 74f7b570c0..983ea2760c 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -1502,6 +1502,7 @@ rb_obj_write(VALUE a, VALUE *slot, VALUE b, RB_UNUSED_VAR(const char *filename),
return a;
}
+#define RUBY_INTEGER_UNIFICATION 1
#define RB_INTEGER_TYPE_P(obj) rb_integer_type_p(obj)
static inline int
rb_integer_type_p(VALUE obj)
@@ -1865,7 +1866,9 @@ RUBY_EXTERN VALUE rb_mWaitWritable;
RUBY_EXTERN VALUE rb_cBasicObject;
RUBY_EXTERN VALUE rb_cObject;
RUBY_EXTERN VALUE rb_cArray;
+#ifndef RUBY_INTEGER_UNIFICATION
RUBY_EXTERN VALUE rb_cBignum;
+#endif
RUBY_EXTERN VALUE rb_cBinding;
RUBY_EXTERN VALUE rb_cClass;
RUBY_EXTERN VALUE rb_cCont;
@@ -1875,7 +1878,9 @@ RUBY_EXTERN VALUE rb_cFalseClass;
RUBY_EXTERN VALUE rb_cEncoding;
RUBY_EXTERN VALUE rb_cEnumerator;
RUBY_EXTERN VALUE rb_cFile;
+#ifndef RUBY_INTEGER_UNIFICATION
RUBY_EXTERN VALUE rb_cFixnum;
+#endif
RUBY_EXTERN VALUE rb_cFloat;
RUBY_EXTERN VALUE rb_cHash;
RUBY_EXTERN VALUE rb_cInteger;