Ticket #1348 (closed patch: fixed)
[patch]changed addrregistry.pmc to use GET_ATTR syntax
| Reported by: | jimmy | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | core | Version: | 1.8.0 |
| Severity: | medium | Keywords: | |
| Cc: | Language: | ||
| Patch status: | new | Platform: |
Description
changed addrregistry.pmc to use GET_ATTR syntax
Index: src/pmc/addrregistry.pmc
===================================================================
--- src/pmc/addrregistry.pmc (版本 42868)
+++ src/pmc/addrregistry.pmc (工作副本)
@@ -73,8 +73,11 @@
*/
VTABLE INTVAL get_integer_keyed(PMC *key) {
- Hash *hash = (Hash *)SELF.get_pointer();
- void *value = parrot_hash_get(INTERP, hash, key);
+ Hash *hash;
+ const void *value;
+
+ GET_ATTR_hash(interp, SELF, hash);
+ value = parrot_hash_get(INTERP, hash, key);
if (value)
return (INTVAL)value;
@@ -83,11 +86,19 @@
}
VTABLE INTVAL elements() {
- return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer());
+ const Hash *hash;
+
+ GET_ATTR_hash(interp, SELF, hash);
+
+ return parrot_hash_size(INTERP, hash);
}
VTABLE INTVAL get_bool() {
- return parrot_hash_size(INTERP, (Hash *)SELF.get_pointer()) != 0;
+ const Hash *hash;
+
+ GET_ATTR_hash(interp, SELF, hash);
+
+ return parrot_hash_size(INTERP, hash) != 0;
}
/*
@@ -111,11 +122,15 @@
*/
VTABLE void set_pmc_keyed(PMC *key, PMC *value) {
- Hash * const hash = (Hash *)SELF.get_pointer();
- void *oldval = parrot_hash_get(INTERP, hash, key);
- long newval = 1;
+ const void *oldval;
+ long newval = 1;
+ Hash *hash;
UNUSED(value);
+ GET_ATTR_hash(interp, SELF, hash);
+
+ oldval = parrot_hash_get(INTERP, hash, key);
+
if (oldval)
newval += (long)oldval;
@@ -123,14 +138,18 @@
}
VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
- Hash *hash = (Hash *)SELF.get_pointer();
+ Hash *hash;
+ GET_ATTR_hash(interp, SELF, hash);
parrot_hash_put(INTERP, hash, key, (void *)value);
}
VTABLE void delete_keyed(PMC *key) {
- Hash * const hash = (Hash *)SELF.get_pointer();
- void *value = parrot_hash_get(INTERP, hash, key);
+ Hash *hash;
+ void *value;
+ GET_ATTR_hash(interp, SELF, hash);
+ value = parrot_hash_get(INTERP, hash, key);
+
/* these casts look bad, but they avoid type punning warnings with -O */
if (value) {
long val = (long)value;
Attachments
Change History
Note: See
TracTickets for help on using
tickets.

