* 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:
parent
8ac05ae500
commit
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>
|
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.
|
* 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(void);
|
||||||
VALUE rb_newobj_of(VALUE, VALUE);
|
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(obj,type) type *(obj) = (type*)rb_newobj()
|
||||||
#define NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
|
#define NEWOBJ_OF(obj,type,klass,flags) type *(obj) = (type*)rb_newobj_of(klass, flags)
|
||||||
#define OBJSETUP(obj,c,t) do {\
|
#define OBJSETUP(obj,c,t) rb_obj_setup(obj, c, t) /* use NEWOBJ_OF instead of NEWOBJ()+OBJSTUP() */
|
||||||
RBASIC(obj)->flags = (t);\
|
|
||||||
RBASIC(obj)->klass = (c);\
|
|
||||||
if (rb_safe_level() >= 3) FL_SET((obj), FL_TAINT | FL_UNTRUSTED);\
|
|
||||||
} while (0)
|
|
||||||
#define CLONESETUP(clone,obj) do {\
|
#define CLONESETUP(clone,obj) do {\
|
||||||
OBJSETUP((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
|
OBJSETUP((clone),rb_singleton_class_clone((VALUE)(obj)),RBASIC(obj)->flags);\
|
||||||
rb_singleton_class_attached(RBASIC(clone)->klass, (VALUE)(clone));\
|
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;
|
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:
|
* call-seq:
|
||||||
* obj === other -> true or false
|
* obj === other -> true or false
|
||||||
|
Loading…
x
Reference in New Issue
Block a user