summaryrefslogtreecommitdiff
path: root/ext/iconv
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-02 14:42:08 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-02 14:42:08 +0000
commit2156870525be05f0bd769af141c3f6cff9fff8c4 (patch)
tree3e6db7f9ecee480edff058e18bc7211a53296f64 /ext/iconv
parent8581164ea67a13fad5e7d56aa4aa75a87f9eafb3 (diff)
* ruby.h (struct RArray): embed small arrays.
(RARRAY_LEN): defined for accessing array members. (RARRAY_PTR): ditto. * array.c: use RARRAY_LEN and RARRAY_PTR. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@10833 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/iconv')
-rw-r--r--ext/iconv/iconv.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c
index 0c89c2ab17..0a5d0dface 100644
--- a/ext/iconv/iconv.c
+++ b/ext/iconv/iconv.c
@@ -350,7 +350,7 @@ iconv_convert(iconv_t cd, VALUE str, int start, int length, struct iconv_env_t*
unsigned int i;
rescue = iconv_fail(error, Qnil, Qnil, env, 0);
if (TYPE(rescue) == T_ARRAY) {
- str = RARRAY(rescue)->len > 0 ? RARRAY(rescue)->ptr[0] : Qnil;
+ str = RARRAY_LEN(rescue) > 0 ? RARRAY_PTR(rescue)[0] : Qnil;
}
if (FIXNUM_P(str) && (i = FIX2INT(str)) <= 0xff) {
char c = i;
@@ -434,9 +434,9 @@ iconv_convert(iconv_t cd, VALUE str, int start, int length, struct iconv_env_t*
str = rb_str_derive(str, inptr, inlen);
rescue = iconv_fail(error, ret, str, env, errmsg);
if (TYPE(rescue) == T_ARRAY) {
- if ((len = RARRAY(rescue)->len) > 0)
- rb_str_concat(ret, RARRAY(rescue)->ptr[0]);
- if (len > 1 && !NIL_P(str = RARRAY(rescue)->ptr[1])) {
+ if ((len = RARRAY_LEN(rescue)) > 0)
+ rb_str_concat(ret, RARRAY_PTR(rescue)[0]);
+ if (len > 1 && !NIL_P(str = RARRAY_PTR(rescue)[1])) {
StringValue(str);
inlen = length = RSTRING_LEN(str);
instart = inptr = RSTRING_PTR(str);