[svn:parrot] r48855 - trunk/src/string/encoding

nwellnhof at svn.parrot.org nwellnhof at svn.parrot.org
Wed Sep 8 14:19:07 UTC 2010


Author: nwellnhof
Date: Wed Sep  8 14:19:06 2010
New Revision: 48855
URL: https://trac.parrot.org/parrot/changeset/48855

Log:
[str] Switch back to str_clone in to_encoding functions

The StringBuilder code expects to get a new buffer.

Modified:
   trunk/src/string/encoding/ascii.c
   trunk/src/string/encoding/binary.c
   trunk/src/string/encoding/latin1.c
   trunk/src/string/encoding/ucs4.c
   trunk/src/string/encoding/utf8.c

Modified: trunk/src/string/encoding/ascii.c
==============================================================================
--- trunk/src/string/encoding/ascii.c	Wed Sep  8 12:14:31 2010	(r48854)
+++ trunk/src/string/encoding/ascii.c	Wed Sep  8 14:19:06 2010	(r48855)
@@ -164,7 +164,7 @@
                     "lossy conversion to ascii");
         }
 
-        dest           = Parrot_str_copy(interp, src);
+        dest           = Parrot_str_clone(interp, src);
         dest->encoding = Parrot_ascii_encoding_ptr;
     }
     else {

Modified: trunk/src/string/encoding/binary.c
==============================================================================
--- trunk/src/string/encoding/binary.c	Wed Sep  8 12:14:31 2010	(r48854)
+++ trunk/src/string/encoding/binary.c	Wed Sep  8 14:19:06 2010	(r48855)
@@ -95,7 +95,7 @@
     ASSERT_ARGS(binary_to_encoding)
     STRING      *dest;
 
-    dest           = Parrot_str_copy(interp, src);
+    dest           = Parrot_str_clone(interp, src);
     dest->encoding = Parrot_binary_encoding_ptr;
     dest->strlen   = dest->bufused;
     dest->hashval  = 0;

Modified: trunk/src/string/encoding/latin1.c
==============================================================================
--- trunk/src/string/encoding/latin1.c	Wed Sep  8 12:14:31 2010	(r48854)
+++ trunk/src/string/encoding/latin1.c	Wed Sep  8 14:19:06 2010	(r48855)
@@ -153,7 +153,7 @@
     STRING      *dest;
 
     if (STRING_max_bytes_per_codepoint(src) == 1) {
-        dest           = Parrot_str_copy(interp, src);
+        dest           = Parrot_str_clone(interp, src);
         dest->encoding = Parrot_latin1_encoding_ptr;
     }
     else {

Modified: trunk/src/string/encoding/ucs4.c
==============================================================================
--- trunk/src/string/encoding/ucs4.c	Wed Sep  8 12:14:31 2010	(r48854)
+++ trunk/src/string/encoding/ucs4.c	Wed Sep  8 14:19:06 2010	(r48855)
@@ -176,7 +176,7 @@
     ASSERT_ARGS(ucs4_to_encoding)
 #if PARROT_HAS_ICU
     if (src->encoding == Parrot_ucs4_encoding_ptr) {
-        return Parrot_str_copy(interp, src);
+        return Parrot_str_clone(interp, src);
     }
     else {
         UINTVAL len = Parrot_str_length(interp, src);

Modified: trunk/src/string/encoding/utf8.c
==============================================================================
--- trunk/src/string/encoding/utf8.c	Wed Sep  8 12:14:31 2010	(r48854)
+++ trunk/src/string/encoding/utf8.c	Wed Sep  8 14:19:06 2010	(r48855)
@@ -196,7 +196,7 @@
     unsigned char *p;
 
     if (src_encoding == Parrot_utf8_encoding_ptr)
-        return Parrot_str_copy(interp, src);
+        return Parrot_str_clone(interp, src);
 
     src_len          = src->strlen;
     result           = Parrot_gc_new_string_header(interp, 0);


More information about the parrot-commits mailing list