summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-29 11:07:45 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-29 11:07:45 (GMT)
commit8e6e8e628888aa251f771ce8b3fe30a6b41a7a0e (patch)
treee531ed455f2ffb110e9a16de2161b3865a19d582 /transcode.c
parent68f97d7851481e11ce90bb349345dc4caed00cf7 (diff)
* use RB_TYPE_P which is optimized for constant types, instead of
comparison with TYPE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33357 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r--transcode.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/transcode.c b/transcode.c
index e813516..9c28395 100644
--- a/transcode.c
+++ b/transcode.c
@@ -2294,7 +2294,7 @@ transcode_loop(const unsigned char **in_pos, unsigned char **out_pos,
if (!ec)
rb_exc_raise(rb_econv_open_exc(src_encoding, dst_encoding, ecflags));
- if (!NIL_P(ecopts) && TYPE(ecopts) == T_HASH) {
+ if (!NIL_P(ecopts) && RB_TYPE_P(ecopts, T_HASH)) {
fallback = rb_hash_aref(ecopts, sym_fallback);
if (RB_TYPE_P(fallback, T_HASH)) {
fallback_func = hash_fallback;
@@ -2471,7 +2471,7 @@ econv_opts(VALUE opt, int ecflags)
else if (v==sym_attr) {
ecflags |= ECONV_XML_ATTR_CONTENT_DECORATOR|ECONV_XML_ATTR_QUOTE_DECORATOR|ECONV_UNDEF_HEX_CHARREF;
}
- else if (TYPE(v) == T_SYMBOL) {
+ else if (RB_TYPE_P(v, T_SYMBOL)) {
rb_raise(rb_eArgError, "unexpected value for xml option: %s", rb_id2name(SYM2ID(v)));
}
else {
@@ -2593,7 +2593,7 @@ rb_econv_open_opts(const char *source_encoding, const char *destination_encoding
replacement = Qnil;
}
else {
- if (TYPE(opthash) != T_HASH || !OBJ_FROZEN(opthash))
+ if (!RB_TYPE_P(opthash, T_HASH) || !OBJ_FROZEN(opthash))
rb_bug("rb_econv_open_opts called with invalid opthash");
replacement = rb_hash_aref(opthash, sym_replace);
}
@@ -3057,7 +3057,7 @@ decorate_convpath(VALUE convpath, int ecflags)
len = n = RARRAY_LENINT(convpath);
if (n != 0) {
VALUE pair = RARRAY_PTR(convpath)[n-1];
- if (TYPE(pair) == T_ARRAY) {
+ if (RB_TYPE_P(pair, T_ARRAY)) {
const char *sname = rb_enc_name(rb_to_encoding(RARRAY_PTR(pair)[0]));
const char *dname = rb_enc_name(rb_to_encoding(RARRAY_PTR(pair)[1]));
transcoder_entry_t *entry = get_transcoder_entry(sname, dname);