[svn:parrot] r49191 - trunk/src/pmc
luben at svn.parrot.org
luben at svn.parrot.org
Mon Sep 20 23:56:30 UTC 2010
Author: luben
Date: Mon Sep 20 23:56:30 2010
New Revision: 49191
URL: https://trac.parrot.org/parrot/changeset/49191
Log:
Revert "use concat instead of join when possible in CodeString"
This was a temporal workaround a bug in StringBuilder
Modified:
trunk/src/pmc/codestring.pmc
Modified: trunk/src/pmc/codestring.pmc
==============================================================================
--- trunk/src/pmc/codestring.pmc Mon Sep 20 23:56:22 2010 (r49190)
+++ trunk/src/pmc/codestring.pmc Mon Sep 20 23:56:30 2010 (r49191)
@@ -107,6 +107,8 @@
STRING * const percent = CONST_STRING(INTERP, "%");
STRING * const comma = CONST_STRING(INTERP, ",");
STRING * const comma_space = CONST_STRING(INTERP, ", ");
+ STRING * const newline = CONST_STRING(INTERP, "\n");
+ PMC *parts = PMCNULL;
STRING *key, *repl, *S1;
INTVAL pos = 0;
INTVAL replen = 0;
@@ -144,18 +146,15 @@
GET_ATTR_str_val(INTERP, SELF, S1);
+ parts = Parrot_pmc_new_init_int(INTERP, enum_class_FixedStringArray, 3);
+ VTABLE_set_string_keyed_int(INTERP, parts, 0, S1);
+ VTABLE_set_string_keyed_int(INTERP, parts, 1, fmt);
+
/* Add a newline if necessary */
- if ('\n' != Parrot_str_indexed(INTERP, fmt, Parrot_str_length(INTERP, fmt) - 1)) {
- STRING * const newline = CONST_STRING(INTERP, "\n");
- PMC *parts = Parrot_pmc_new_init_int(INTERP, enum_class_FixedStringArray, 3);
- VTABLE_set_string_keyed_int(INTERP, parts, 0, S1);
- VTABLE_set_string_keyed_int(INTERP, parts, 1, fmt);
+ if ('\n' != Parrot_str_indexed(INTERP, fmt, Parrot_str_length(INTERP, fmt) - 1))
VTABLE_set_string_keyed_int(INTERP, parts, 2, newline);
- S1 = Parrot_str_join(INTERP, STRINGNULL, parts);
- }
- else
- S1 = Parrot_str_concat(INTERP, S1, fmt);
+ S1 = Parrot_str_join(INTERP, STRINGNULL, parts);
VTABLE_set_string_native(INTERP, SELF, S1);
RETURN(PMC *SELF);
More information about the parrot-commits
mailing list