[svn:parrot] r48667 - trunk/src/pmc

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Thu Aug 26 13:09:12 UTC 2010


Author: nwellnhof
Date: Thu Aug 26 13:09:12 2010
New Revision: 48667
URL: https://trac.parrot.org/parrot/changeset/48667

Log:
Small fix to append_format in StringBuilder PMC

Handle empty arg list for "%," format correctly

Modified:
   trunk/src/pmc/stringbuilder.pmc

Modified: trunk/src/pmc/stringbuilder.pmc
==============================================================================
--- trunk/src/pmc/stringbuilder.pmc	Thu Aug 26 12:42:06 2010	(r48666)
+++ trunk/src/pmc/stringbuilder.pmc	Thu Aug 26 13:09:12 2010	(r48667)
@@ -353,16 +353,13 @@
             }
             else if (Parrot_str_equal(INTERP, key, comma)) {
                 INTVAL num_args = VTABLE_elements(INTERP, args);
-                INTVAL pos_args = 1;
+                INTVAL pos_args;
 
-                VTABLE_push_string(INTERP, stringbuilder,
-                    VTABLE_get_string_keyed_int(INTERP, args, 0));
-
-                while (pos_args < num_args) {
-                    VTABLE_push_string(INTERP, stringbuilder, comma_space);
+                for (pos_args = 0; pos_args < num_args; ++pos_args) {
+                    if (pos_args > 0)
+                        VTABLE_push_string(INTERP, stringbuilder, comma_space);
                     VTABLE_push_string(INTERP, stringbuilder,
                         VTABLE_get_string_keyed_int(INTERP, args, pos_args));
-                    pos_args++;
                 }
             }
             else if (Parrot_str_equal(INTERP, key, percent)) {


More information about the parrot-commits mailing list