Ticket #1348: addrregistry_2.pmc.patch
File addrregistry_2.pmc.patch, 2.3 KB (added by jimmy, 12 years ago) |
---|
-
src/pmc/addrregistry.pmc
73 73 */ 74 74 75 75 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); 78 81 79 82 if (value) 80 83 return (INTVAL)value; … … 83 86 } 84 87 85 88 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); 87 94 } 88 95 89 96 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; 91 102 } 92 103 /* 93 104 … … 111 122 */ 112 123 113 124 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; 117 128 UNUSED(value); 118 129 130 GET_ATTR_hash(interp, SELF, hash); 131 132 oldval = parrot_hash_get(INTERP, hash, key); 133 119 134 if (oldval) 120 135 newval += (long)oldval; 121 136 … … 123 138 } 124 139 125 140 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); 127 143 parrot_hash_put(INTERP, hash, key, (void *)value); 128 144 } 129 145 130 146 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; 133 149 150 GET_ATTR_hash(interp, SELF, hash); 151 value = parrot_hash_get(INTERP, hash, key); 152 134 153 /* these casts look bad, but they avoid type punning warnings with -O */ 135 154 if (value) { 136 155 long val = (long)value;