Ticket #986: kill-strstart.patch

File kill-strstart.patch, 2.9 KB (added by darbelo, 12 years ago)
  • compilers/imcc/pbc.c

     
    12131213 
    12141214                    PMC_get_sub(interp, sub_pmc, sub); 
    12151215                    IMCC_debug(interp, DEBUG_PBC_CONST, 
    1216                             "add lexical '%s' to sub name '%s'\n", 
    1217                             n->name, (char*)sub->name->strstart); 
     1216                            "add lexical '%s' to sub name '%Ss'\n", 
     1217                            n->name, sub->name); 
    12181218 
    12191219                    Parrot_PCCINVOKE(interp, lex_info, 
    12201220                            string_from_literal(interp, "declare_lex_preg"), 
     
    12551255    subs_t      *s; 
    12561256    PMC         *current; 
    12571257    STRING      *cur_name; 
     1258    char        *cur_name_str; 
    12581259    Parrot_Sub_attributes *sub; 
    12591260    size_t      len; 
    12601261 
     
    12891290    PMC_get_sub(interp, current, sub); 
    12901291    cur_name = sub->name; 
    12911292 
    1292     if (cur_name->strlen == len 
    1293     && (memcmp((char*)cur_name->strstart, unit->outer->name, len) == 0)) 
     1293    cur_name_str = Parrot_str_to_cstring(interp,  sub->name); 
     1294    if (strlen(cur_name_str) == len 
     1295    && (memcmp(cur_name_str, unit->outer->name, len) == 0)) { 
     1296        Parrot_str_free_cstring(cur_name_str); 
    12941297        return current; 
    1295  
     1298    } 
     1299    Parrot_str_free_cstring(cur_name_str); 
    12961300    return NULL; 
    12971301} 
    12981302 
     
    15111515        PMC_get_sub(interp, sub->outer_sub, outer_sub); 
    15121516 
    15131517    IMCC_debug(interp, DEBUG_PBC_CONST, 
    1514             "add_const_pmc_sub '%s' flags %x color %d (%s) " 
    1515             "lex_info %s :outer(%s)\n", 
     1518            "add_const_pmc_sub '%s' flags %x color %d (%Ss) " 
     1519            "lex_info %s :outer(%Ss)\n", 
    15161520            r->name, r->pcc_sub->pragma, k, 
    1517             (char *) sub_pmc->vtable->whoami->strstart, 
     1521            sub_pmc->vtable->whoami, 
    15181522            sub->lex_info ? "yes" : "no", 
    1519             sub->outer_sub ? 
    1520                 (char *)outer_sub->name->strstart : 
    1521                 "*none*"); 
     1523            sub->outer_sub? outer_sub->name : 
     1524            Parrot_str_new(interp, "*none*", 0)); 
    15221525 
    15231526    /* 
    15241527     * create entry in our fixup (=symbol) table 
  • compilers/pirc/src/bcgen.c

     
    912912    PMC          *current; 
    913913    Parrot_Sub_attributes *sub; 
    914914    STRING       *cur_name; 
     915    STRING       *out_name; 
    915916    size_t        len; 
    916917    global_label *outersub; 
    917918 
     
    959960    PMC_get_sub(interp, current, sub); 
    960961    cur_name = sub->name; 
    961962 
    962     /* XXX can't this be a call to Parrot_str_compare() ? */ 
    963     if (cur_name->strlen == len && (memcmp((char *)cur_name->strstart, outername, len) == 0)) 
     963    out_name = Parrot_str_new(interp, outername, len); 
     964    if (Parrot_str_compare(interp, cur_name, out_name) == 0) 
    964965        return current; 
    965966 
    966967    return NULL;