[svn:parrot] r46684 - trunk/compilers/imcc

NotFound at svn.parrot.org NotFound at svn.parrot.org
Sat May 15 21:25:08 UTC 2010


Author: NotFound
Date: Sat May 15 21:25:07 2010
New Revision: 46684
URL: https://trac.parrot.org/parrot/changeset/46684

Log:
[imcc] fix search for namespace separator in add_const_pmc_sub, TT #1640

Modified:
   trunk/compilers/imcc/pbc.c

Modified: trunk/compilers/imcc/pbc.c
==============================================================================
--- trunk/compilers/imcc/pbc.c	Sat May 15 20:33:15 2010	(r46683)
+++ trunk/compilers/imcc/pbc.c	Sat May 15 21:25:07 2010	(r46684)
@@ -1278,7 +1278,19 @@
 
     if (unit->_namespace) {
         /* strip namespace off from front */
-        const char *real_name = strrchr(r->name, '@');
+
+        static const char ns_sep[] = "@@@";
+        char *real_name = strstr(r->name, ns_sep);
+        if (real_name) {
+            /* Unfortunately, there is no strrstr, then iterate until last */
+            char *aux = strstr(real_name + 3, ns_sep);
+            while (aux) {
+                 real_name = aux;
+                aux = strstr(real_name + 3, ns_sep);
+            }
+            real_name += 3;
+        }
+
         SymReg     * const ns = unit->_namespace->reg;
 
         IMCC_debug(interp, DEBUG_PBC_CONST,
@@ -1287,7 +1299,7 @@
         ns_const  = ns->color;
 
         if (real_name) {
-            char * const p = mem_sys_strdup(real_name + 1);
+            char * const p = mem_sys_strdup(real_name);
             mem_sys_free(r->name);
             r->name = p;
         }


More information about the parrot-commits mailing list