[svn:parrot] r48780 - trunk/src/string
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Sep 4 15:03:48 UTC 2010
Author: chromatic
Date: Sat Sep 4 15:03:48 2010
New Revision: 48780
URL: https://trac.parrot.org/parrot/changeset/48780
Log:
[str] Ported Parrot_str_join() to StringBuilder.
If there's no STRING on which to join the array elements, SB's init_pmc() works
just fine.
Modified:
trunk/src/string/api.c
Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c Sat Sep 4 15:03:45 2010 (r48779)
+++ trunk/src/string/api.c Sat Sep 4 15:03:48 2010 (r48780)
@@ -3249,6 +3249,7 @@
STRING **chunks;
STRING *res;
STRING *s;
+ PMC *sb;
char *pos;
const int ar_len = VTABLE_elements(interp, ar);
int total_length = 0;
@@ -3258,8 +3259,10 @@
if (ar_len == 0)
return Parrot_str_new_noinit(interp, enum_stringrep_one, 0);
- if (STRING_IS_NULL(j))
- j = Parrot_str_new_noinit(interp, enum_stringrep_one, 0);
+ if (STRING_IS_NULL(j)) {
+ sb = Parrot_pmc_new_init(interp, enum_class_StringBuilder, ar);
+ return VTABLE_get_string(interp, sb);
+ }
/* We don't mark "chunks". So block GC here to avoid crash */
Parrot_block_GC_mark(interp);
More information about the parrot-commits
mailing list