[svn:parrot] r46290 - in trunk: src/pmc t/pmc

darbelo at svn.parrot.org darbelo at svn.parrot.org
Tue May 4 22:17:01 UTC 2010


Author: darbelo
Date: Tue May  4 22:17:00 2010
New Revision: 46290
URL: https://trac.parrot.org/parrot/changeset/46290

Log:
Obliterate the 'reverse' method on String PMC's.

Modified:
   trunk/src/pmc/string.pmc
   trunk/t/pmc/string.t

Modified: trunk/src/pmc/string.pmc
==============================================================================
--- trunk/src/pmc/string.pmc	Tue May  4 22:16:04 2010	(r46289)
+++ trunk/src/pmc/string.pmc	Tue May  4 22:17:00 2010	(r46290)
@@ -713,38 +713,6 @@
 
 /*
 
-=item C<void reverse(STRING *src)>
-
-Reverse the ascii STRING C<src> in place.
-
-=cut
-
-*/
-
-    METHOD reverse(STRING *src) {
-        INTVAL         i;
-        unsigned char *p;
-        INTVAL         len = Parrot_str_byte_length(interp, src);
-
-        if (!len)
-            RETURN(void);
-
-        if (src->charset != Parrot_ascii_charset_ptr)
-            Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_ENCODING,
-                "Can't reverse non-ascii");
-
-        p = (unsigned char *)Buffer_bufstart(src);
-
-        for (i = 0, --len; i < len; ++i, --len) {
-            const unsigned char ch = p[len];
-
-            p[len] = p[i];
-            p[i]   = ch;
-        }
-    }
-
-/*
-
 =item C<INTEGER is_integer(STRING *src)>
 
 Checks if the ascii STRING C<str> is just an integer.

Modified: trunk/t/pmc/string.t
==============================================================================
--- trunk/t/pmc/string.t	Tue May  4 22:16:04 2010	(r46289)
+++ trunk/t/pmc/string.t	Tue May  4 22:17:00 2010	(r46290)
@@ -20,7 +20,7 @@
 .sub main :main
     .include 'test_more.pir'
 
-    plan(167)
+    plan(166)
 
     set_or_get_strings()
     setting_integers()
@@ -56,7 +56,6 @@
     test_string_replace()
     set_i0__p0__string_to_int()
     test_string_trans()
-    reverse_p0__reverse_string()
     is_integer__check_integer()
     instantiate_str()
     get_string_returns_cow_string()
@@ -840,13 +839,6 @@
     .return(tr_array)
 .end
 
-.sub reverse_p0__reverse_string
-    $S0 = 'torrap'
-    $P0 = new ['String']
-    $P0.'reverse'($S0)
-    is( $S0, "parrot", 'reverse string' )
-.end
-
 .sub is_integer__check_integer
   $P0 = new ['String']
 


More information about the parrot-commits mailing list