зеркало из https://github.com/github/ruby.git
* object.c (rb_obj_setup): added.
* include/ruby/ruby.h (OBJSETUP): ues rb_obj_setup() instead of a macro. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40687 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
8ac05ae500
Коммит
b6b85f6eaf
|
@ -1,3 +1,10 @@
|
|||
Mon May 13 15:31:10 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* object.c (rb_obj_setup): added.
|
||||
|
||||
* include/ruby/ruby.h (OBJSETUP): ues rb_obj_setup() instead of
|
||||
a macro.
|
||||
|
||||
Mon May 13 15:24:16 2013 Koichi Sasada <ko1@atdot.net>
|
||||
|
||||
* gc.c (rb_data_object_alloc): check klass only if klass is not 0.
|
||||
|
|
|
@ -667,13 +667,10 @@ VALUE rb_int2big(SIGNED_VALUE);
|
|||
|
||||
VALUE rb_newobj(void);
|
||||
VALUE rb_newobj_of(VALUE, VALUE);
|
||||
VALUE rb_obj_setup(VALUE obj, VALUE klass, VALUE type);
|
||||
#define NEWOBJ(obj,type) type *(obj) = (type*)rb_newobj()
|
||||
#define NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
|
||||
#define OBJSETUP(obj,c,t) do {\
|
||||
RBASIC(obj)->flags = (t);\
|
||||
RBASIC(obj)->klass = (c);\
|
||||
if (rb_safe_level() >= 3) FL_SET((obj), FL_TAINT | FL_UNTRUSTED);\
|
||||
} while (0)
|
||||
#define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSTUP() */
|
||||
#define CLONESETUP(clone,obj) do {\
|
||||
OBJSETUP((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
|
||||
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)(clone));\
|
||||
|
|
9
object.c
9
object.c
|
@ -58,6 +58,15 @@ rb_obj_hide(VALUE obj)
|
|||
return obj;
|
||||
}
|
||||
|
||||
VALUE
|
||||
rb_obj_setup(VALUE obj, VALUE klass, VALUE type)
|
||||
{
|
||||
RBASIC(obj)->flags = type;
|
||||
RBASIC(obj)->klass = klass;
|
||||
if (rb_safe_level() >= 3) FL_SET((obj), FL_TAINT | FL_UNTRUSTED);
|
||||
return obj;
|
||||
}
|
||||
|
||||
/*
|
||||
* call-seq:
|
||||
* obj === other -> true or false
|
||||
|
|
Загрузка…
Ссылка в новой задаче