ruby-changes:34960
From: nobu <ko1@a...>
Date: Sun, 3 Aug 2014 10:56:12 +0900 (JST)
Subject: [ruby-changes:34960] nobu:r47042 (trunk): ext: prefer RB_TYPE_P over comparison TYPE with constants
nobu 2014-08-03 10:56:01 +0900 (Sun, 03 Aug 2014) New Revision: 47042 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47042 Log: ext: prefer RB_TYPE_P over comparison TYPE with constants Modified files: trunk/ext/date/date_core.c trunk/ext/date/date_parse.c trunk/ext/openssl/ossl_bio.c trunk/ext/openssl/ossl_digest.c trunk/ext/openssl/ossl_pkcs7.c trunk/ext/openssl/ossl_ssl.c trunk/ext/tk/tcltklib.c trunk/ext/tk/tkutil/tkutil.c trunk/ext/win32ole/win32ole.c Index: ext/win32ole/win32ole.c =================================================================== --- ext/win32ole/win32ole.c (revision 47041) +++ ext/win32ole/win32ole.c (revision 47042) @@ -1363,7 +1363,7 @@ ole_ary_m_entry(VALUE val, LONG *pid) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1363 VALUE obj = Qnil; int i = 0; obj = val; - while(TYPE(obj) == T_ARRAY) { + while(RB_TYPE_P(obj, T_ARRAY)) { obj = rb_ary_entry(obj, pid[i]); i++; } @@ -1489,7 +1489,7 @@ dimension(VALUE val) { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1489 long dim1 = 0; long len = 0; long i = 0; - if (TYPE(val) == T_ARRAY) { + if (RB_TYPE_P(val, T_ARRAY)) { len = RARRAY_LEN(val); for (i = 0; i < len; i++) { dim1 = dimension(rb_ary_entry(val, i)); @@ -1510,11 +1510,11 @@ ary_len_of_dim(VALUE ary, long dim) { https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1510 long i = 0; VALUE val; if (dim == 0) { - if (TYPE(ary) == T_ARRAY) { + if (RB_TYPE_P(ary, T_ARRAY)) { ary_len = RARRAY_LEN(ary); } } else { - if (TYPE(ary) == T_ARRAY) { + if (RB_TYPE_P(ary, T_ARRAY)) { len = RARRAY_LEN(ary); for (i = 0; i < len; i++) { val = rb_ary_entry(ary, i); @@ -1915,7 +1915,7 @@ ole_val2olevariantdata(VALUE val, VARTYP https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L1915 { HRESULT hr = S_OK; - if (((vt & ~VT_BYREF) == (VT_ARRAY | VT_UI1)) && TYPE(val) == T_STRING) { + if (((vt & ~VT_BYREF) == (VT_ARRAY | VT_UI1)) && RB_TYPE_P(val, T_STRING)) { long len = RSTRING_LEN(val); void *pdest = NULL; SAFEARRAY *p = NULL; @@ -2859,9 +2859,9 @@ fole_s_const_load(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2859 LCID lcid = cWIN32OLE_lcid; rb_scan_args(argc, argv, "11", &ole, &klass); - if (TYPE(klass) != T_CLASS && - TYPE(klass) != T_MODULE && - TYPE(klass) != T_NIL) { + if (!RB_TYPE_P(klass, T_CLASS) && + !RB_TYPE_P(klass, T_MODULE) && + !RB_TYPE_P(klass, T_NIL)) { rb_raise(rb_eTypeError, "2nd parameter must be Class or Module"); } if (rb_obj_is_kind_of(ole, cWIN32OLE)) { @@ -2877,7 +2877,7 @@ fole_s_const_load(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2877 ole_raise(hr, rb_eRuntimeError, "failed to GetContainingTypeLib"); } OLE_RELEASE(pTypeInfo); - if(TYPE(klass) != T_NIL) { + if(!RB_TYPE_P(klass, T_NIL)) { ole_const_load(pTypeLib, klass, self); } else { @@ -2885,7 +2885,7 @@ fole_s_const_load(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2885 } OLE_RELEASE(pTypeLib); } - else if(TYPE(ole) == T_STRING) { + else if(RB_TYPE_P(ole, T_STRING)) { file = typelib_file(ole); if (file == Qnil) { file = ole; @@ -2895,7 +2895,7 @@ fole_s_const_load(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L2895 SysFreeString(pBuf); if (FAILED(hr)) ole_raise(hr, eWIN32OLERuntimeError, "failed to LoadTypeLibEx"); - if(TYPE(klass) != T_NIL) { + if(!RB_TYPE_P(klass, T_NIL)) { ole_const_load(pTypeLib, klass, self); } else { @@ -3043,7 +3043,7 @@ fole_s_show_help(int argc, VALUE *argv, https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3043 } else { helpfile = target; } - if (TYPE(helpfile) != T_STRING) { + if (!RB_TYPE_P(helpfile, T_STRING)) { rb_raise(rb_eTypeError, "1st parameter must be (String|WIN32OLE_TYPE|WIN32OLE_METHOD)"); } hwnd = ole_show_help(helpfile, helpcontext); @@ -3346,7 +3346,7 @@ hash2named_arg(RB_BLOCK_CALL_FUNC_ARGLIS https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3346 the data-type of key must be String or Symbol -----------------------------------------------*/ key = rb_ary_entry(pair, 0); - if(TYPE(key) != T_STRING && TYPE(key) != T_SYMBOL) { + if(!RB_TYPE_P(key, T_STRING) && !RB_TYPE_P(key, T_SYMBOL)) { /* clear name of dispatch parameters */ for(i = 1; i < index + 1; i++) { SysFreeString(pOp->pNamedArgs[i]); @@ -3358,7 +3358,7 @@ hash2named_arg(RB_BLOCK_CALL_FUNC_ARGLIS https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3358 /* raise an exception */ rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)"); } - if (TYPE(key) == T_SYMBOL) { + if (RB_TYPE_P(key, T_SYMBOL)) { key = rb_sym_to_s(key); } @@ -3424,10 +3424,10 @@ ole_invoke(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3424 op.dp.cArgs = 0; rb_scan_args(argc, argv, "1*", &cmd, ¶mS); - if(TYPE(cmd) != T_STRING && TYPE(cmd) != T_SYMBOL && !is_bracket) { + if(!RB_TYPE_P(cmd, T_STRING) && !RB_TYPE_P(cmd, T_SYMBOL) && !is_bracket) { rb_raise(rb_eTypeError, "method is wrong type (expected String or Symbol)"); } - if (TYPE(cmd) == T_SYMBOL) { + if (RB_TYPE_P(cmd, T_SYMBOL)) { cmd = rb_sym_to_s(cmd); } OLEData_Get_Struct(self, pole); @@ -3456,7 +3456,7 @@ ole_invoke(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L3456 op.dp.cNamedArgs = 0; /* if last arg is hash object */ - if(TYPE(param) == T_HASH) { + if(RB_TYPE_P(param, T_HASH)) { /*------------------------------------------ hash object ==> named dispatch parameters --------------------------------------------*/ @@ -4591,10 +4591,10 @@ fole_respond_to(VALUE self, VALUE method https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L4591 BSTR wcmdname; DISPID DispID; HRESULT hr; - if(TYPE(method) != T_STRING && TYPE(method) != T_SYMBOL) { + if(!RB_TYPE_P(method, T_STRING) && !RB_TYPE_P(method, T_SYMBOL)) { rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)"); } - if (TYPE(method) == T_SYMBOL) { + if (RB_TYPE_P(method, T_SYMBOL)) { method = rb_sym_to_s(method); } OLEData_Get_Struct(self, pole); @@ -7750,8 +7750,8 @@ ole_search_event_at(VALUE ary, VALUE ev) https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L7750 ret = i; break; } - else if (TYPE(ev) == T_STRING && - TYPE(event_name) == T_STRING && + else if (RB_TYPE_P(ev, T_STRING) && + RB_TYPE_P(event_name, T_STRING) && rb_str_cmp(ev, event_name) == 0) { ret = i; break; @@ -7926,7 +7926,7 @@ STDMETHODIMP EVENTSINK_Invoke( https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L7926 } ary = rb_ivar_get(obj, id_events); - if (NIL_P(ary) || TYPE(ary) != T_ARRAY) { + if (NIL_P(ary) || !RB_TYPE_P(ary, T_ARRAY)) { return NOERROR; } hr = pTypeInfo->lpVtbl->GetNames(pTypeInfo, dispid, @@ -7936,7 +7936,7 @@ STDMETHODIMP EVENTSINK_Invoke( https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L7936 } ev = WC2VSTR(bstr); event = ole_search_event(ary, ev, &is_default_handler); - if (TYPE(event) == T_ARRAY) { + if (RB_TYPE_P(event, T_ARRAY)) { handler = rb_ary_entry(event, 0); mid = rb_intern("call"); is_outarg = rb_ary_entry(event, 3); @@ -7981,10 +7981,10 @@ STDMETHODIMP EVENTSINK_Invoke( https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L7981 if (state != 0) { rescue_callback(Qnil); } - if(TYPE(result) == T_HASH) { + if(RB_TYPE_P(result, T_HASH)) { hash2ptr_dispparams(result, pTypeInfo, dispid, pdispparams); result = hash2result(result); - }else if (is_outarg == Qtrue && TYPE(outargv) == T_ARRAY) { + }else if (is_outarg == Qtrue && RB_TYPE_P(outargv, T_ARRAY)) { ary2ptr_dispparams(outargv, pdispparams); } @@ -8384,7 +8384,7 @@ ev_advise(int argc, VALUE *argv, VALUE s https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8384 rb_raise(rb_eTypeError, "1st parameter must be WIN32OLE object"); } - if(TYPE(itf) != T_NIL) { + if(!RB_TYPE_P(itf, T_NIL)) { if (rb_safe_level() > 0 && OBJ_TAINTED(itf)) { rb_raise(rb_eSecurityError, "Insecure Event Creation - %s", StringValuePtr(itf)); @@ -8478,7 +8478,7 @@ static void https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8478 add_event_call_back(VALUE obj, VALUE event, VALUE data) { VALUE events = rb_ivar_get(obj, id_events); - if (NIL_P(events) || TYPE(events) != T_ARRAY) { + if (NIL_P(events) || !RB_TYPE_P(events, T_ARRAY)) { events = rb_ary_new(); rb_ivar_set(obj, id_events, events); } @@ -8497,10 +8497,10 @@ ev_on_event(int argc, VALUE *argv, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8497 } rb_scan_args(argc, argv, "01*", &event, &args); if(!NIL_P(event)) { - if(TYPE(event) != T_STRING && TYPE(event) != T_SYMBOL) { + if(!RB_TYPE_P(event, T_STRING) && !RB_TYPE_P(event, T_SYMBOL)) { rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)"); } - if (TYPE(event) == T_SYMBOL) { + if (RB_TYPE_P(event, T_SYMBOL)) { event = rb_sym_to_s(event); } } @@ -8587,10 +8587,10 @@ fev_off_event(int argc, VALUE *argv, VAL https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L8587 rb_scan_args(argc, argv, "01", &event); if(!NIL_P(event)) { - if(TYPE(event) != T_STRING && TYPE(event) != T_SYMBOL) { + if(!RB_TYPE_P(event, T_STRING) && !RB_TYPE_P(event, T_SYMBOL)) { rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)"); } - if (TYPE(event) == T_SYMBOL) { + if (RB_TYPE_P(event, T_SYMBOL)) { event = rb_sym_to_s(event); } } @@ -9152,7 +9152,7 @@ folevariant_set_value(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9152 VARTYPE vt; Data_Get_Struct(self, struct olevariantdata, pvar); vt = V_VT(&(pvar->var)); - if (V_ISARRAY(&(pvar->var)) && ((vt & ~VT_BYREF) != (VT_UI1|VT_ARRAY) || TYPE(val) != T_STRING)) { + if (V_ISARRAY(&(pvar->var)) && ((vt & ~VT_BYREF) != (VT_UI1|VT_ARRAY) || !RB_TYPE_P(val, T_STRING))) { rb_raise(eWIN32OLERuntimeError, "`value=' is not available for this variant type object"); } @@ -9348,10 +9348,10 @@ folerecord_initialize(VALUE self, VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9348 ITypeLib *pTypeLib = NULL; IRecordInfo *pri = NULL; - if (TYPE(typename) != T_STRING && TYPE(typename) != T_SYMBOL) { + if (!RB_TYPE_P(typename, T_STRING) && !RB_TYPE_P(typename, T_SYMBOL)) { rb_raise(rb_eArgError, "1st argument should be String or Symbol"); } - if (TYPE(typename) == T_SYMBOL) { + if (RB_TYPE_P(typename, T_SYMBOL)) { typename = rb_sym_to_s(typename); } @@ -9559,11 +9559,11 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9559 folerecord_ole_instance_variable_get(VALUE self, VALUE name) { VALUE sname; - if(TYPE(name) != T_STRING && TYPE(name) != T_SYMBOL) { + if(!RB_TYPE_P(name, T_STRING) && !RB_TYPE_P(name, T_SYMBOL)) { rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)"); } sname = name; - if (TYPE(name) == T_SYMBOL) { + if (RB_TYPE_P(name, T_SYMBOL)) { sname = rb_sym_to_s(name); } return olerecord_ivar_get(self, sname); @@ -9598,11 +9598,11 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/ext/win32ole/win32ole.c#L9598 folerecord_ole_instance_variable_set(VALUE self, VALUE name, VALUE val) { VALUE sname; - if(TYPE(name) != T_STRING && TYPE(name) != T_SYMBOL) { + if(!RB_TYPE_P(name, T_STRING) && !RB_TYPE_P(name, T_SYMBOL)) { rb_raise(rb_eTypeError, "wrong argument type (expected String or Symbol)"); } sname = name; - if (TYPE(name) == T_SYMBOL) { + if (RB_TYPE_P(name, T_SYMBOL)) { sname = rb_sym_to_s(name); } return olerecord_ivar_set(self, sname, val); Index: ext/date/date_core.c =================================================================== --- ext/date/date_core.c (revision 47041) +++ ext/date/date_core.c (revision 47042) @@ -304,7 +304,7 @@ union DateData { https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L304 inline static VALUE canon(VALUE x) { - if (TYPE(x) == T_RATIONAL) { + if (RB_TYPE_P(x, T_RATIONAL)) { VALUE den = rb_rational_den(x); if (FIXNUM_P(den) && FIX2LONG(den) == 1) return rb_rational_num(x); @@ -5843,7 +5843,7 @@ minus_dd(VALUE self, VALUE other) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L5843 if (f_nonzero_p(sf)) r = f_add(r, ns_to_day(sf)); - if (TYPE(r) == T_RATIONAL) + if (RB_TYPE_P(r, T_RATIONAL)) return r; return rb_rational_new1(r); } @@ -7048,7 +7048,7 @@ d_lite_marshal_load(VALUE self, VALUE a) https://github.com/ruby/ruby/blob/trunk/ext/date/date_core.c#L7048 rb_check_frozen(self); rb_check_trusted(self); - if (TYPE(a) != T_ARRAY) + if (!RB_TYPE_P(a, T_ARRAY)) rb_raise(rb_eTypeError, "expected an array"); switch (RARRAY_LEN(a)) { Index: ext/date/date_parse.c =================================================================== --- ext/date/date_parse.c (revision 47041) +++ ext/date/date_parse.c (revision 47042) @@ -70,7 +70,7 @@ s3e(VALUE hash, VALUE y, VALUE m, VALUE https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L70 { VALUE c = Qnil; - if (TYPE(m) != T_STRING) + if (!RB_TYPE_P(m, T_STRING)) m = f_to_s(m); if (!NIL_P(y) && !NIL_P(m) && NIL_P(d)) { @@ -585,12 +585,12 @@ date_zone_to_diff(VALUE str) https://github.com/ruby/ruby/blob/trunk/ext/date/date_parse.c#L585 if (NIL_P(hour)) offset = INT2FIX(0); else { - if (TYPE(hour) == T_STRING) + if (RB_TYPE_P(hour, T_STRING)) hour = str2num(hour); offset = f_mul(hour, INT2FIX(3600)); } if (!NIL_P(min)) { - if (TYPE(min) == T_STRING) + if (RB_TYPE_P(min, T_STRING)) min = str2num(min); offset = f_add(offset, f_mul(min, INT2FIX(60))); } Index: ext/tk/tcltklib.c =================================================================== --- ext/tk/tcltklib.c (revision 47041) +++ ext/tk/tcltklib.c (revision 47042) @@ -3110,7 +3110,7 @@ ip_set_exc_message(interp, exc) https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L3110 } if (NIL_P(enc)) { encoding = (Tcl_Encoding)NULL; - } else if (TYPE(enc) == T_STRING) { + } else if (RB_TYPE_P(enc, T_STRING)) { /* encoding = Tcl_GetEncoding(interp, RSTRING_PTR(enc)); */ encoding = Tcl_GetEncoding((Tcl_Interp*)NULL, RSTRING_PTR(enc)); } else { @@ -3320,7 +3320,7 @@ tcl_protect_core(interp, proc, data) /* https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L3320 if (rb_obj_is_kind_of(exc, eLocalJumpError)) { VALUE reason = rb_ivar_get(exc, ID_at_reason); - if (TYPE(reason) == T_SYMBOL) { + if (RB_TYPE_P(reason, T_SYMBOL)) { if (SYM2ID(reason) == ID_return) return TCL_RETURN; @@ -7949,7 +7949,7 @@ lib_toUTF8_core(ip_obj, src, encodename) https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L7949 rb_thread_critical = Qtrue; if (NIL_P(encodename)) { - if (TYPE(str) == T_STRING) { + if (RB_TYPE_P(str, T_STRING)) { volatile VALUE enc; #ifdef HAVE_RUBY_ENCODING_H @@ -8127,7 +8127,7 @@ lib_fromUTF8_core(ip_obj, src, encodenam https://github.com/ruby/ruby/blob/trunk/ext/tk/tcltklib.c#L8127 if (NIL_P(encodename)) { volatile VALUE enc; - if (TYPE(str) == T_STRING) { + if (RB_TYPE_P(str, T_STRING)) { enc = rb_attr_get(str, ID_at_enc); if (!NIL_P(enc)) { StringValue(enc); Index: ext/tk/tkutil/tkutil.c =================================================================== --- ext/tk/tkutil/tkutil.c (revision 47041) +++ ext/tk/tkutil/tkutil.c (revision 47042) @@ -312,7 +312,7 @@ ary2list(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L312 if (NIL_P(enc_flag)) { dst_enc = sys_enc; req_chk_flag = 1; - } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) { + } else if (enc_flag == Qtrue || enc_flag == Qfalse) { dst_enc = enc_flag; req_chk_flag = 0; } else { @@ -323,7 +323,7 @@ ary2list(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L323 /* size = RARRAY_LEN(ary); */ size = 0; for(idx = 0; idx < RARRAY_LEN(ary); idx++) { - if (TYPE(RARRAY_PTR(ary)[idx]) == T_HASH) { + if (RB_TYPE_P(RARRAY_PTR(ary)[idx], T_HASH)) { size += 2 * RHASH_SIZE(RARRAY_PTR(ary)[idx]); } else { size++; @@ -433,7 +433,7 @@ ary2list(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L433 RARRAY_PTR(dst)[idx] = str_val; } val = rb_apply(cTclTkLib, ID_merge_tklist, dst); - if (TYPE(dst_enc) == T_STRING) { + if (RB_TYPE_P(dst_enc, T_STRING)) { val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc); rb_ivar_set(val, ID_at_enc, dst_enc); } else { @@ -466,7 +466,7 @@ ary2list2(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L466 if (NIL_P(enc_flag)) { dst_enc = sys_enc; req_chk_flag = 1; - } else if (TYPE(enc_flag) == T_TRUE || TYPE(enc_flag) == T_FALSE) { + } else if (enc_flag == Qtrue || enc_flag == Qfalse) { dst_enc = enc_flag; req_chk_flag = 0; } else { @@ -527,7 +527,7 @@ ary2list2(ary, enc_flag, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L527 RARRAY_PTR(dst)[idx] = str_val; } val = rb_apply(cTclTkLib, ID_merge_tklist, dst); - if (TYPE(dst_enc) == T_STRING) { + if (RB_TYPE_P(dst_enc, T_STRING)) { val = rb_funcall(cTclTkLib, ID_fromUTF8, 2, val, dst_enc); rb_ivar_set(val, ID_at_enc, dst_enc); } else { @@ -561,7 +561,7 @@ assoc2kv(assoc, ary, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L561 for(i = 0; i < len; i++) { pair = RARRAY_PTR(assoc)[i]; - if (TYPE(pair) != T_ARRAY) { + if (!RB_TYPE_P(pair, T_ARRAY)) { rb_ary_push(dst, key2keyname(pair)); continue; } @@ -609,7 +609,7 @@ assoc2kv_enc(assoc, ary, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L609 for(i = 0; i < len; i++) { pair = RARRAY_PTR(assoc)[i]; - if (TYPE(pair) != T_ARRAY) { + if (!RB_TYPE_P(pair, T_ARRAY)) { rb_ary_push(dst, key2keyname(pair)); continue; } @@ -950,7 +950,7 @@ tk_conv_args(argc, argv, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L950 old_gc = rb_gc_disable(); for(size = 0, idx = 2; idx < argc; idx++) { - if (TYPE(argv[idx]) == T_HASH) { + if (RB_TYPE_P(argv[idx], T_HASH)) { size += 2 * RHASH_SIZE(argv[idx]); } else { size++; @@ -959,7 +959,7 @@ tk_conv_args(argc, argv, self) https://github.com/ruby/ruby/blob/trunk/ext/tk/tkutil/tkutil.c#L959 /* dst = rb_ary_new2(argc - 2); */ dst = rb_ary_new2(size); for(idx = 2; idx < argc; idx++) { - (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/