* array.c (rb_ary_and, rb_ary_or), class.c (rb_mod_init_copy),
gc.c (undefine_final), time.c (time_mload): get rid of type-punning casts. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29492 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
421076be67
commit
7735e63593
@ -1,3 +1,9 @@
|
|||||||
|
Thu Oct 14 07:22:12 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
|
* array.c (rb_ary_and, rb_ary_or), class.c (rb_mod_init_copy),
|
||||||
|
gc.c (undefine_final), time.c (time_mload): get rid of
|
||||||
|
type-punning casts.
|
||||||
|
|
||||||
Thu Oct 14 04:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
Thu Oct 14 04:16:41 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
* numeric.c (ruby_float_step): fix Numeric#step with infinity unit
|
* numeric.c (ruby_float_step): fix Numeric#step with infinity unit
|
||||||
|
19
array.c
19
array.c
@ -3341,7 +3341,8 @@ rb_ary_diff(VALUE ary1, VALUE ary2)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_ary_and(VALUE ary1, VALUE ary2)
|
rb_ary_and(VALUE ary1, VALUE ary2)
|
||||||
{
|
{
|
||||||
VALUE hash, ary3, v, vv;
|
VALUE hash, ary3, v;
|
||||||
|
st_data_t vv;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
ary2 = to_ary(ary2);
|
ary2 = to_ary(ary2);
|
||||||
@ -3353,8 +3354,8 @@ rb_ary_and(VALUE ary1, VALUE ary2)
|
|||||||
return ary3;
|
return ary3;
|
||||||
|
|
||||||
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
||||||
v = vv = rb_ary_elt(ary1, i);
|
vv = (st_data_t)(v = rb_ary_elt(ary1, i));
|
||||||
if (st_delete(RHASH_TBL(hash), (st_data_t*)&vv, 0)) {
|
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
||||||
rb_ary_push(ary3, v);
|
rb_ary_push(ary3, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3377,8 +3378,8 @@ rb_ary_and(VALUE ary1, VALUE ary2)
|
|||||||
static VALUE
|
static VALUE
|
||||||
rb_ary_or(VALUE ary1, VALUE ary2)
|
rb_ary_or(VALUE ary1, VALUE ary2)
|
||||||
{
|
{
|
||||||
VALUE hash, ary3;
|
VALUE hash, ary3, v;
|
||||||
VALUE v, vv;
|
st_data_t vv;
|
||||||
long i;
|
long i;
|
||||||
|
|
||||||
ary2 = to_ary(ary2);
|
ary2 = to_ary(ary2);
|
||||||
@ -3386,14 +3387,14 @@ rb_ary_or(VALUE ary1, VALUE ary2)
|
|||||||
hash = ary_add_hash(ary_make_hash(ary1), ary2);
|
hash = ary_add_hash(ary_make_hash(ary1), ary2);
|
||||||
|
|
||||||
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
for (i=0; i<RARRAY_LEN(ary1); i++) {
|
||||||
v = vv = rb_ary_elt(ary1, i);
|
vv = (st_data_t)(v = rb_ary_elt(ary1, i));
|
||||||
if (st_delete(RHASH_TBL(hash), (st_data_t*)&vv, 0)) {
|
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
||||||
rb_ary_push(ary3, v);
|
rb_ary_push(ary3, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i=0; i<RARRAY_LEN(ary2); i++) {
|
for (i=0; i<RARRAY_LEN(ary2); i++) {
|
||||||
v = vv = rb_ary_elt(ary2, i);
|
vv = (st_data_t)(v = rb_ary_elt(ary2, i));
|
||||||
if (st_delete(RHASH_TBL(hash), (st_data_t*)&vv, 0)) {
|
if (st_delete(RHASH_TBL(hash), &vv, 0)) {
|
||||||
rb_ary_push(ary3, v);
|
rb_ary_push(ary3, v);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
6
class.c
6
class.c
@ -150,16 +150,16 @@ rb_mod_init_copy(VALUE clone, VALUE orig)
|
|||||||
}
|
}
|
||||||
RCLASS_SUPER(clone) = RCLASS_SUPER(orig);
|
RCLASS_SUPER(clone) = RCLASS_SUPER(orig);
|
||||||
if (RCLASS_IV_TBL(orig)) {
|
if (RCLASS_IV_TBL(orig)) {
|
||||||
ID id;
|
st_data_t id;
|
||||||
|
|
||||||
if (RCLASS_IV_TBL(clone)) {
|
if (RCLASS_IV_TBL(clone)) {
|
||||||
st_free_table(RCLASS_IV_TBL(clone));
|
st_free_table(RCLASS_IV_TBL(clone));
|
||||||
}
|
}
|
||||||
RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(orig));
|
RCLASS_IV_TBL(clone) = st_copy(RCLASS_IV_TBL(orig));
|
||||||
CONST_ID(id, "__classpath__");
|
CONST_ID(id, "__classpath__");
|
||||||
st_delete(RCLASS_IV_TBL(clone), (st_data_t*)&id, 0);
|
st_delete(RCLASS_IV_TBL(clone), &id, 0);
|
||||||
CONST_ID(id, "__classid__");
|
CONST_ID(id, "__classid__");
|
||||||
st_delete(RCLASS_IV_TBL(clone), (st_data_t*)&id, 0);
|
st_delete(RCLASS_IV_TBL(clone), &id, 0);
|
||||||
}
|
}
|
||||||
if (RCLASS_M_TBL(orig)) {
|
if (RCLASS_M_TBL(orig)) {
|
||||||
struct clone_method_data data;
|
struct clone_method_data data;
|
||||||
|
3
gc.c
3
gc.c
@ -2679,7 +2679,8 @@ undefine_final(VALUE os, VALUE obj)
|
|||||||
rb_objspace_t *objspace = &rb_objspace;
|
rb_objspace_t *objspace = &rb_objspace;
|
||||||
if (OBJ_FROZEN(obj)) rb_error_frozen("object");
|
if (OBJ_FROZEN(obj)) rb_error_frozen("object");
|
||||||
if (finalizer_table) {
|
if (finalizer_table) {
|
||||||
st_delete(finalizer_table, (st_data_t*)&obj, 0);
|
st_data_t data = obj;
|
||||||
|
st_delete(finalizer_table, &data, 0);
|
||||||
}
|
}
|
||||||
FL_UNSET(obj, FL_FINALIZE);
|
FL_UNSET(obj, FL_FINALIZE);
|
||||||
return obj;
|
return obj;
|
||||||
|
30
time.c
30
time.c
@ -4683,26 +4683,24 @@ time_mload(VALUE time, VALUE str)
|
|||||||
long nsec;
|
long nsec;
|
||||||
VALUE submicro, nano_num, nano_den, offset;
|
VALUE submicro, nano_num, nano_den, offset;
|
||||||
wideval_t timew;
|
wideval_t timew;
|
||||||
|
st_data_t data;
|
||||||
|
|
||||||
time_modify(time);
|
time_modify(time);
|
||||||
|
|
||||||
nano_num = rb_attr_get(str, id_nano_num);
|
#define get_attr(attr, iffound) \
|
||||||
if (nano_num != Qnil) {
|
attr = rb_attr_get(str, id_##attr); \
|
||||||
st_delete(rb_generic_ivar_table(str), (st_data_t*)&id_nano_num, 0);
|
if (!NIL_P(attr)) { \
|
||||||
}
|
data = id_##attr; \
|
||||||
nano_den = rb_attr_get(str, id_nano_den);
|
iffound; \
|
||||||
if (nano_den != Qnil) {
|
st_delete(rb_generic_ivar_table(str), &data, 0); \
|
||||||
st_delete(rb_generic_ivar_table(str), (st_data_t*)&id_nano_den, 0);
|
|
||||||
}
|
|
||||||
submicro = rb_attr_get(str, id_submicro);
|
|
||||||
if (submicro != Qnil) {
|
|
||||||
st_delete(rb_generic_ivar_table(str), (st_data_t*)&id_submicro, 0);
|
|
||||||
}
|
|
||||||
offset = rb_attr_get(str, id_offset);
|
|
||||||
if (offset != Qnil) {
|
|
||||||
validate_utc_offset(offset);
|
|
||||||
st_delete(rb_generic_ivar_table(str), (st_data_t*)&id_offset, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_attr(nano_num, {});
|
||||||
|
get_attr(nano_den, {});
|
||||||
|
get_attr(submicro, {});
|
||||||
|
get_attr(offset, validate_utc_offset(offset));
|
||||||
|
#undef get_attr
|
||||||
|
|
||||||
rb_copy_generic_ivar(time, str);
|
rb_copy_generic_ivar(time, str);
|
||||||
|
|
||||||
StringValue(str);
|
StringValue(str);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user