[svn:parrot] r48360 - branches/unshared_buffers/src/string/encoding
darbelo at svn.parrot.org
darbelo at svn.parrot.org
Mon Aug 9 21:05:29 UTC 2010
Author: darbelo
Date: Mon Aug 9 21:05:28 2010
New Revision: 48360
URL: https://trac.parrot.org/parrot/changeset/48360
Log:
Don't rely on Parrot_str_new_init() for fixed_8 get_bytes.
Modified:
branches/unshared_buffers/src/string/encoding/fixed_8.c
Modified: branches/unshared_buffers/src/string/encoding/fixed_8.c
==============================================================================
--- branches/unshared_buffers/src/string/encoding/fixed_8.c Mon Aug 9 21:00:12 2010 (r48359)
+++ branches/unshared_buffers/src/string/encoding/fixed_8.c Mon Aug 9 21:05:28 2010 (r48360)
@@ -320,9 +320,15 @@
get_bytes(PARROT_INTERP, ARGIN(const STRING *src), UINTVAL offset, UINTVAL count)
{
ASSERT_ARGS(get_bytes)
+ const UINTVAL flags = PObj_get_FLAGS(src) & ~PObj_external_FLAG;
+ STRING * const dst = Parrot_gc_new_string_header(interp, flags);
- return Parrot_str_new_init(interp, src->strstart + offset, count,
- src->encoding, src->charset, PObj_get_FLAGS(src));
+ dst->encoding = src->encoding;
+ dst->charset = src->charset;
+ dst->bufused = dst->strlen = count;
+ Parrot_gc_allocate_string_storage(interp, dst, count);
+ mem_sys_memcopy(dst->strstart, src->strstart + offset, count);
+ return dst;
}
More information about the parrot-commits
mailing list