[svn:parrot] r45422 - in trunk/src: ops string

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Apr 7 13:10:46 UTC 2010


Author: bacek
Date: Wed Apr  7 13:10:46 2010
New Revision: 45422
URL: https://trac.parrot.org/parrot/changeset/45422

Log:
Remove few str_copy calls

Modified:
   trunk/src/ops/set.ops
   trunk/src/ops/string.ops
   trunk/src/string/api.c

Modified: trunk/src/ops/set.ops
==============================================================================
--- trunk/src/ops/set.ops	Wed Apr  7 13:10:32 2010	(r45421)
+++ trunk/src/ops/set.ops	Wed Apr  7 13:10:46 2010	(r45422)
@@ -27,7 +27,7 @@
 inline op clone(out STR, in STR) :base_mem {
     /* cloning a NULL STRING produces an empty STRING; TT #964 */
     $1 = $2
-       ? Parrot_str_copy(interp, $2)
+       ? $2
        : Parrot_str_new(interp, NULL, 0);
 }
 
@@ -154,7 +154,7 @@
 }
 
 inline op set(out STR, inconst STR) :base_core {
-    $1 = Parrot_str_copy(interp, $2);
+    $1 = $2;
 }
 
 inline op set(out STR, in INT) :base_core {
@@ -186,8 +186,7 @@
 }
 
 inline op set(invar PMC, inconst STR) :base_core {
-    VTABLE_set_string_native(interp, $1,
-        Parrot_str_copy(interp, $2));
+    VTABLE_set_string_native(interp, $1, $2);
 }
 inline op set(out INT, invar PMC) :base_core {
     $1 = VTABLE_get_integer(interp, $2);

Modified: trunk/src/ops/string.ops
==============================================================================
--- trunk/src/ops/string.ops	Wed Apr  7 13:10:32 2010	(r45421)
+++ trunk/src/ops/string.ops	Wed Apr  7 13:10:46 2010	(r45422)
@@ -529,8 +529,7 @@
 }
 
 op charsetname(out STR, in INT) :base_core {
-    STRING * const name = Parrot_charset_name(interp, $2);
-    $1 = name ? Parrot_str_copy(interp, name) : NULL;
+    $1 = Parrot_charset_name(interp, $2);
 }
 
 op find_charset(out INT, in STR) :base_core {
@@ -585,8 +584,7 @@
 }
 
 op encodingname(out STR, in INT) :base_core {
-    STRING * const name = Parrot_encoding_name(interp, $2);
-    $1 = name ? Parrot_str_copy(interp, name) : NULL;
+    $1 = Parrot_encoding_name(interp, $2);
 }
 
 op find_encoding(out INT, in STR) :base_core {

Modified: trunk/src/string/api.c
==============================================================================
--- trunk/src/string/api.c	Wed Apr  7 13:10:32 2010	(r45421)
+++ trunk/src/string/api.c	Wed Apr  7 13:10:46 2010	(r45422)
@@ -359,11 +359,11 @@
             return Parrot_str_append(interp, result, b);
         }
 
-        return Parrot_str_copy(interp, a);
+        return a;
     }
 
     return b
-        ? Parrot_str_copy(interp, b)
+        ? b
         : string_make(interp, NULL, 0, NULL, Uflags);
 }
 
@@ -401,7 +401,7 @@
 
     /* Is A real? */
     if (a == NULL || Buffer_bufstart(a) == NULL)
-        return Parrot_str_copy(interp, b);
+        return b;
 
     saneify_string(a);
     saneify_string(b);


More information about the parrot-commits mailing list