[svn:parrot] r48387 - branches/unshared_buffers/src/string/encoding
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Tue Aug 10 21:03:05 UTC 2010
Author: darbelo
Date: Tue Aug 10 21:03:05 2010
New Revision: 48387
URL: https://trac.parrot.org/parrot/changeset/48387
Log:
Make ucs4 not depend on str_new.
Modified:
branches/unshared_buffers/src/string/encoding/ucs4.c
Modified: branches/unshared_buffers/src/string/encoding/ucs4.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/ucs4.c Tue Aug 10 21:02:47 2010 (r48386)
+++ branches/unshared_buffers/src/string/encoding/ucs4.c Tue Aug 10 21:03:05 2010 (r48387)
@@ -336,8 +336,18 @@
{
ASSERT_ARGS(get_codepoints)
#if PARROT_HAS_ICU
- return Parrot_str_new_init(interp, (char*)Buffer_bufstart(src) + offset * sizeof (UChar32),
- count * sizeof (UChar32), src->encoding, src->charset, 0);
+ const UINTVAL flags = PObj_get_FLAGS(src) & ~PObj_external_FLAG;
+ STRING * const dst = Parrot_gc_new_string_header(interp, flags);
+
+ dst->encoding = src->encoding;
+ dst->charset = src->charset;
+ dst->strlen = count;
+ dst->bufused = count * sizeof (UChar32);
+ Parrot_gc_allocate_string_storage(interp, dst, count);
+ mem_sys_memcopy(Buffer_bufstart(dst),
+ Buffer_bufstart(src) + offset * sizeof (UChar32),
+ count * sizeof (UChar32));
+ return dst;
#else
UNUSED(src);
UNUSED(offset);
More information about the parrot-commits
mailing list