diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-18 03:05:11 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-18 03:05:11 +0000 |
commit | 19f386674eb5cfbf9c8fd6041114829f37888d17 (patch) | |
tree | 766bda2001fc604141fbe7c8b51417d6c0e8fc2f | |
parent | 3b59f6c56278b1314f5b01a192ed03966aa3d0db (diff) |
* include/ruby/backward/classext.h: for evil gems. fixed #4803
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | include/ruby/backward/classext.h | 18 | ||||
-rw-r--r-- | include/ruby/intern.h | 1 | ||||
-rw-r--r-- | include/ruby/ruby.h | 6 | ||||
-rw-r--r-- | internal.h | 12 | ||||
-rw-r--r-- | object.c | 6 |
6 files changed, 42 insertions, 5 deletions
@@ -1,3 +1,7 @@ +Sat Jun 18 12:05:08 2011 Nobuyoshi Nakada <[email protected]> + + * include/ruby/backward/classext.h: for evil gems. fixed #4803 + Sat Jun 18 11:12:13 2011 Tanaka Akira <[email protected]> * common.mk: update dependencies. diff --git a/include/ruby/backward/classext.h b/include/ruby/backward/classext.h new file mode 100644 index 0000000000..615e6f6858 --- /dev/null +++ b/include/ruby/backward/classext.h @@ -0,0 +1,18 @@ +#if defined __GNUC__ +#warning use of RClass internals is deprecated +#elif defined _MSC_VER || defined __BORLANDC__ +#pragma message("warning: use of RClass internals is deprecated") +#endif + +#ifndef RUBY_BACKWARD_CLASSEXT_H +#define RUBY_BACKWARD_CLASSEXT_H 1 + +typedef struct rb_deprecated_classext_struct { + VALUE super; +} rb_deprecated_classext_t; + +#undef RCLASS_SUPER(c) +#define RCLASS_EXT(c) ((rb_deprecated_classext_t *)RCLASS(c)->ptr) +#define RCLASS_SUPER(c) (RCLASS_EXT(c)->super) + +#endif /* RUBY_BACKWARD_CLASSEXT_H */ diff --git a/include/ruby/intern.h b/include/ruby/intern.h index bc3c4491cd..582fa8801d 100644 --- a/include/ruby/intern.h +++ b/include/ruby/intern.h @@ -519,6 +519,7 @@ VALUE rb_obj_class(VALUE); VALUE rb_class_real(VALUE); VALUE rb_class_inherited_p(VALUE, VALUE); VALUE rb_class_superclass(VALUE); +VALUE rb_class_get_superclass(VALUE); VALUE rb_convert_type(VALUE,int,const char*,const char*); VALUE rb_check_convert_type(VALUE,int,const char*,const char*); VALUE rb_check_to_integer(VALUE, const char *); diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 38bfe3f56c..340bea102a 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -617,11 +617,7 @@ struct RClass { struct st_table *m_tbl; struct st_table *iv_index_tbl; }; -#define RCLASS_IV_TBL(c) (RCLASS(c)->ptr->iv_tbl) -#define RCLASS_CONST_TBL(c) (RCLASS(c)->ptr->const_tbl) -#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl) -#define RCLASS_SUPER(c) (RCLASS(c)->ptr->super) -#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl) +#define RCLASS_SUPER(c) rb_class_get_superclass(c) #define RMODULE_IV_TBL(m) RCLASS_IV_TBL(m) #define RMODULE_CONST_TBL(m) RCLASS_CONST_TBL(m) #define RMODULE_M_TBL(m) RCLASS_M_TBL(m) diff --git a/internal.h b/internal.h index c95c5f87f6..2cc3b529df 100644 --- a/internal.h +++ b/internal.h @@ -19,12 +19,24 @@ extern "C" { #endif #endif +struct rb_deprecated_classext_struct { + char conflict[sizeof(VALUE) * 3]; +}; + struct rb_classext_struct { VALUE super; struct st_table *iv_tbl; struct st_table *const_tbl; }; +#undef RCLASS_SUPER +#define RCLASS_EXT(c) (RCLASS(c)->ptr) +#define RCLASS_SUPER(c) (RCLASS_EXT(c)->super) +#define RCLASS_IV_TBL(c) (RCLASS_EXT(c)->iv_tbl) +#define RCLASS_CONST_TBL(c) (RCLASS_EXT(c)->const_tbl) +#define RCLASS_M_TBL(c) (RCLASS(c)->m_tbl) +#define RCLASS_IV_INDEX_TBL(c) (RCLASS(c)->iv_index_tbl) + struct vtm; /* defined by timev.h */ /* bignum.c */ @@ -1668,6 +1668,12 @@ rb_class_superclass(VALUE klass) return super; } +VALUE +rb_class_get_superclass(VALUE klass) +{ + return RCLASS_SUPER(klass); +} + /* * call-seq: * attr_reader(symbol, ...) -> nil |