[svn:parrot] r41197 - in trunk/compilers: imcc pirc/src

darbelo at svn.parrot.org darbelo at svn.parrot.org
Fri Sep 11 00:25:59 UTC 2009


Author: darbelo
Date: Fri Sep 11 00:25:57 2009
New Revision: 41197
URL: https://trac.parrot.org/parrot/changeset/41197

Log:
Remove more strstart uses, this time from pirc and imcc.

Modified:
   trunk/compilers/imcc/pbc.c
   trunk/compilers/pirc/src/bcgen.c

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	Thu Sep 10 23:28:30 2009	(r41196)
+++ trunk/compilers/imcc/pbc.c	Fri Sep 11 00:25:57 2009	(r41197)
@@ -1213,8 +1213,8 @@
 
                     PMC_get_sub(interp, sub_pmc, sub);
                     IMCC_debug(interp, DEBUG_PBC_CONST,
-                            "add lexical '%s' to sub name '%s'\n",
-                            n->name, (char*)sub->name->strstart);
+                            "add lexical '%s' to sub name '%Ss'\n",
+                            n->name, sub->name);
 
                     Parrot_PCCINVOKE(interp, lex_info,
                             string_from_literal(interp, "declare_lex_preg"),
@@ -1255,6 +1255,7 @@
     subs_t      *s;
     PMC         *current;
     STRING      *cur_name;
+    char        *cur_name_str;
     Parrot_Sub_attributes *sub;
     size_t      len;
 
@@ -1289,10 +1290,13 @@
     PMC_get_sub(interp, current, sub);
     cur_name = sub->name;
 
-    if (cur_name->strlen == len
-    && (memcmp((char*)cur_name->strstart, unit->outer->name, len) == 0))
+    cur_name_str = Parrot_str_to_cstring(interp,  sub->name);
+    if (strlen(cur_name_str) == len
+    && (memcmp(cur_name_str, unit->outer->name, len) == 0)) {
+        Parrot_str_free_cstring(cur_name_str);
         return current;
-
+    }
+    Parrot_str_free_cstring(cur_name_str);
     return NULL;
 }
 
@@ -1511,14 +1515,13 @@
         PMC_get_sub(interp, sub->outer_sub, outer_sub);
 
     IMCC_debug(interp, DEBUG_PBC_CONST,
-            "add_const_pmc_sub '%s' flags %x color %d (%s) "
-            "lex_info %s :outer(%s)\n",
+            "add_const_pmc_sub '%s' flags %x color %d (%Ss) "
+            "lex_info %s :outer(%Ss)\n",
             r->name, r->pcc_sub->pragma, k,
-            (char *) sub_pmc->vtable->whoami->strstart,
+            sub_pmc->vtable->whoami,
             sub->lex_info ? "yes" : "no",
-            sub->outer_sub ?
-                (char *)outer_sub->name->strstart :
-                "*none*");
+            sub->outer_sub? outer_sub->name :
+            Parrot_str_new(interp, "*none*", 0));
 
     /*
      * create entry in our fixup (=symbol) table

Modified: trunk/compilers/pirc/src/bcgen.c
==============================================================================
--- trunk/compilers/pirc/src/bcgen.c	Thu Sep 10 23:28:30 2009	(r41196)
+++ trunk/compilers/pirc/src/bcgen.c	Fri Sep 11 00:25:57 2009	(r41197)
@@ -912,6 +912,7 @@
     PMC          *current;
     Parrot_Sub_attributes *sub;
     STRING       *cur_name;
+    STRING       *out_name;
     size_t        len;
     global_label *outersub;
 
@@ -959,8 +960,8 @@
     PMC_get_sub(interp, current, sub);
     cur_name = sub->name;
 
-    /* XXX can't this be a call to Parrot_str_compare() ? */
-    if (cur_name->strlen == len && (memcmp((char *)cur_name->strstart, outername, len) == 0))
+    out_name = Parrot_str_new(interp, outername, len);
+    if (Parrot_str_compare(interp, cur_name, out_name) == 0)
         return current;
 
     return NULL;


More information about the parrot-commits mailing list