Ticket #1348: addrregistry_2.pmc.patch

File addrregistry_2.pmc.patch, 2.3 KB (added by jimmy, 12 years ago)
  • src/pmc/addrregistry.pmc

     
    7373*/ 
    7474 
    7575    VTABLE INTVAL get_integer_keyed(PMC *key) { 
    76         Hash   *hash  = (Hash *)SELF.get_pointer(); 
    77         void   *value = parrot_hash_get(INTERP, hash, key); 
     76        Hash       *hash; 
     77        const void *value; 
     78         
     79        GET_ATTR_hash(interp, SELF, hash); 
     80        value = parrot_hash_get(INTERP, hash, key); 
    7881 
    7982        if (value) 
    8083            return (INTVAL)value; 
     
    8386    } 
    8487 
    8588    VTABLE INTVAL elements() { 
    86         return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer()); 
     89        const Hash *hash; 
     90 
     91        GET_ATTR_hash(interp, SELF, hash); 
     92 
     93        return parrot_hash_size(INTERP, hash); 
    8794    } 
    8895 
    8996    VTABLE INTVAL get_bool() { 
    90         return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer()) != 0; 
     97        const Hash *hash; 
     98 
     99        GET_ATTR_hash(interp, SELF, hash); 
     100 
     101        return parrot_hash_size(INTERP, hash) != 0; 
    91102    } 
    92103/* 
    93104 
     
    111122*/ 
    112123 
    113124    VTABLE void set_pmc_keyed(PMC *key, PMC *value) { 
    114         Hash       * const hash = (Hash *)SELF.get_pointer(); 
    115         void       *oldval      = parrot_hash_get(INTERP, hash, key); 
    116         long        newval      = 1; 
     125        const void *oldval; 
     126        long        newval = 1; 
     127        Hash       *hash; 
    117128        UNUSED(value); 
    118129 
     130        GET_ATTR_hash(interp, SELF, hash); 
     131 
     132        oldval = parrot_hash_get(INTERP, hash, key); 
     133 
    119134        if (oldval) 
    120135            newval += (long)oldval; 
    121136 
     
    123138    } 
    124139 
    125140    VTABLE void set_integer_keyed(PMC *key, INTVAL value) { 
    126         Hash *hash = (Hash *)SELF.get_pointer(); 
     141        Hash *hash; 
     142        GET_ATTR_hash(interp, SELF, hash); 
    127143        parrot_hash_put(INTERP, hash, key, (void *)value); 
    128144    } 
    129145 
    130146    VTABLE void delete_keyed(PMC *key) { 
    131         Hash       * const hash  = (Hash *)SELF.get_pointer(); 
    132         void              *value = parrot_hash_get(INTERP, hash, key); 
     147        Hash       *hash; 
     148        void       *value; 
    133149 
     150        GET_ATTR_hash(interp, SELF, hash); 
     151        value = parrot_hash_get(INTERP, hash, key); 
     152 
    134153        /* these casts look bad, but they avoid type punning warnings with -O */ 
    135154        if (value) { 
    136155            long val = (long)value;