[前][次][番号順一覧][スレッド一覧]

ruby-changes:30773

From: nobu <ko1@a...>
Date: Fri, 6 Sep 2013 11:29:25 +0900 (JST)
Subject: [ruby-changes:30773] nobu:r42852 (trunk): transcode.c: do while loop

nobu	2013-09-06 11:29:17 +0900 (Fri, 06 Sep 2013)

  New Revision: 42852

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42852

  Log:
    transcode.c: do while loop
    
    * transcode.c (rb_econv_substr_append): move loop condition after the
      conversion.

  Modified files:
    trunk/transcode.c
Index: transcode.c
===================================================================
--- transcode.c	(revision 42851)
+++ transcode.c	(revision 42852)
@@ -1828,8 +1828,7 @@ rb_econv_substr_append(rb_econv_t *ec, V https://github.com/ruby/ruby/blob/trunk/transcode.c#L1828
     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, V https://github.com/ruby/ruby/blob/trunk/transcode.c#L1847
         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;

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]