diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-06 02:29:17 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-06 02:29:17 +0000 |
commit | a3a7645f1995fb85f0d5eeb4ebd7cf630b1f4f7b (patch) | |
tree | f54aadf9b87a7e1230616f255fbc8054801e373c /transcode.c | |
parent | a4eae61521d2abe4bc60b1d02356b95751bf184a (diff) |
transcode.c: do while loop
* transcode.c (rb_econv_substr_append): move loop condition after the
conversion.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'transcode.c')
-rw-r--r-- | transcode.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/transcode.c b/transcode.c index f43131d6bc..4a810a1b42 100644 --- a/transcode.c +++ b/transcode.c @@ -1828,8 +1828,7 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, else max_output = 1; - res = econv_destination_buffer_full; - while (res == econv_destination_buffer_full) { + do { long dlen = RSTRING_LEN(dst); if (rb_str_capacity(dst) - dlen < (size_t)len + max_output) { unsigned long new_capa = (unsigned long)dlen + len + max_output; @@ -1848,7 +1847,7 @@ rb_econv_substr_append(rb_econv_t *ec, VALUE src, long off, long len, VALUE dst, len -= sp - ss; rb_str_set_len(dst, dlen + (dp - ds)); rb_econv_check_error(ec); - } + } while (res == econv_destination_buffer_full); RB_GC_GUARD(src); return dst; |