mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 23:33:45 +02:00
Fix implementation of OBJ_INIT_COPY
for Ruby < 1.9
This commit is contained in:
parent
fd08583edd
commit
cb302d2475
1 changed files with 2 additions and 2 deletions
|
@ -166,7 +166,7 @@ DEF_TYPE_CUSTOMNAME_AND_FREE(Klass, Name, freeInstance<Klass>)
|
||||||
BUILTIN_TYPE(obj) == (type)))
|
BUILTIN_TYPE(obj) == (type)))
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OBJ_INIT_COPY(a, b) rb_obj_init_copy(a, b)
|
#define OBJ_INIT_COPY(a, b) (a != b && (rb_obj_init_copy(a, b), 1))
|
||||||
|
|
||||||
#define DEF_ALLOCFUNC_CUSTOMFREE(type, free) \
|
#define DEF_ALLOCFUNC_CUSTOMFREE(type, free) \
|
||||||
static VALUE type##Allocate(VALUE klass) { \
|
static VALUE type##Allocate(VALUE klass) { \
|
||||||
|
@ -505,7 +505,7 @@ RB_METHOD_GUARD(Typ##Load) { return objectLoad<Typ>(argc, argv, self); } RB_METH
|
||||||
RB_METHOD_GUARD(Klass##InitializeCopy) { \
|
RB_METHOD_GUARD(Klass##InitializeCopy) { \
|
||||||
VALUE origObj; \
|
VALUE origObj; \
|
||||||
rb_get_args(argc, argv, "o", &origObj RB_ARG_END); \
|
rb_get_args(argc, argv, "o", &origObj RB_ARG_END); \
|
||||||
if (!OBJ_INIT_COPY(self, origObj)) /* When would this fail??*/ \
|
if (!OBJ_INIT_COPY(self, origObj)) \
|
||||||
return self; \
|
return self; \
|
||||||
Klass *orig = getPrivateData<Klass>(origObj); \
|
Klass *orig = getPrivateData<Klass>(origObj); \
|
||||||
Klass *k = 0; \
|
Klass *k = 0; \
|
||||||
|
|
Loading…
Add table
Reference in a new issue