1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

internal.h: RB_OBJ_BUILTIN_TYPE

* internal.h (RB_OBJ_BUILTIN_TYPE): special-const safe
  BUILTIN_TYPE.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-10-28 06:58:19 +00:00
parent b03a92c4ce
commit 9e75488ac8
4 changed files with 25 additions and 2 deletions

View file

@ -1,3 +1,8 @@
Fri Oct 28 15:58:16 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* internal.h (RB_OBJ_BUILTIN_TYPE): special-const safe
BUILTIN_TYPE.
Fri Oct 28 15:20:18 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* complex.c (id_finite_p, id_infinite_p, id_rationalize, id_PI):

View file

@ -922,7 +922,7 @@ objspace_internal_super_of(VALUE self, VALUE obj)
obj = (VALUE)DATA_PTR(obj);
}
switch (TYPE(obj)) {
switch (OBJ_BUILTIN_TYPE(obj)) {
case T_MODULE:
case T_CLASS:
case T_ICLASS:

2
file.c
View file

@ -4346,7 +4346,7 @@ rb_file_join(VALUE ary, VALUE sep)
OBJ_INFECT(result, ary);
for (i=0; i<RARRAY_LEN(ary); i++) {
tmp = RARRAY_AREF(ary, i);
switch (TYPE(tmp)) {
switch (OBJ_BUILTIN_TYPE(tmp)) {
case T_STRING:
if (!checked) check_path_encoding(tmp);
StringValueCStr(tmp);

View file

@ -1682,6 +1682,24 @@ do { \
} \
} while (0)
#define RB_OBJ_BUILTIN_TYPE(obj) rb_obj_builtin_type(obj)
#define OBJ_BUILTIN_TYPE(obj) RB_OBJ_BUILTIN_TYPE(obj)
#ifdef __GNUC__
#define rb_obj_builtin_type(obj) \
__extension__({ \
VALUE arg_obj = (obj); \
RB_SPECIAL_CONST_P(arg_obj) ? -1 : \
RB_BUILTIN_TYPE(arg_obj); \
})
#else
static inline int
rb_obj_builtin_type(VALUE obj)
{
return RB_SPECIAL_CONST_P(obj) ? -1 :
RB_BUILTIN_TYPE(obj);
}
#endif
#if defined(__cplusplus)
#if 0
{ /* satisfy cc-mode */