summaryrefslogtreecommitdiff
path: root/transcode.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-06 02:29:17 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-09-06 02:29:17 (GMT)
commita3a7645f1995fb85f0d5eeb4ebd7cf630b1f4f7b (patch)
treef54aadf9b87a7e1230616f255fbc8054801e373c /transcode.c
parenta4eae61521d2abe4bc60b1d02356b95751bf184a (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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/transcode.c b/transcode.c
index f43131d..4a810a1 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;