Ticket #1348 (closed patch: fixed)

Opened 12 years ago

Last modified 12 years ago

[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

addrregistry_2.pmc.patch Download (2.3 KB) - added by jimmy 12 years ago.
20091205.42903.parrot.Vtable_addrregistry.txt Download (94.5 KB) - added by jkeenan 12 years ago.
'make' failures (Linux/i386) with patches in TT 1347, 1348 and 1354 applied

Change History

Changed 12 years ago by jimmy

follow-up: ↓ 2   Changed 12 years ago by jkeenan

  • component changed from none to core
  • patch set to new

Thank you for the 8 patches. I recognize that that represents a considerable amount of work.

I decided to live dangerously and apply all 8 patches at once. make failed. I then reverted all patches except that to lib/Parrot/Vtable.pm (TT #1354); make succeeded.

I than applied both patches that affect src/pmc/addrregistry.pmc (TT #1347 and this one, TT #1348). make failed in the same way that it did when I applied all 8 patches. Please see attachment.

Thank you very much.

kid51

Changed 12 years ago by jkeenan

'make' failures (Linux/i386) with patches in TT 1347, 1348 and 1354 applied

in reply to: ↑ 1   Changed 12 years ago by jimmy

Replying to jkeenan:

Thank you for the 8 patches. I recognize that that represents a considerable amount of work. I decided to live dangerously and apply all 8 patches at once. make failed. I then reverted all patches except that to lib/Parrot/Vtable.pm (TT #1354); make succeeded. I than applied both patches that affect src/pmc/addrregistry.pmc (TT #1347 and this one, TT #1348). make failed in the same way that it did when I applied all 8 patches. Please see attachment. Thank you very much. kid51

Thank you for testing. I had already uploaded 11 patches, including #886, #896, #1280. chromatic suggested me to segregate them into small patches, so I segregated them. Could you applied which maked succeeded? Though I have tested them and all maked succeded, I think there just were some small compiling bugs. I will fix the failed patches.

  Changed 12 years ago by cotto

  • status changed from new to closed
  • resolution set to fixed

Thanks for taking the time to submit this patch. I applied it as r42954.

Note: See TracTickets for help on using tickets.