[svn:parrot] r40102 - trunk/src/pmc

bacek at svn.parrot.org bacek at svn.parrot.org
Wed Jul 15 13:47:03 UTC 2009


Author: bacek
Date: Wed Jul 15 13:47:01 2009
New Revision: 40102
URL: https://trac.parrot.org/parrot/changeset/40102

Log:
[cage] Pacify compiler on casting INTVAL to void*

Modified:
   trunk/src/pmc/hash.pmc

Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc	Wed Jul 15 13:19:16 2009	(r40101)
+++ trunk/src/pmc/hash.pmc	Wed Jul 15 13:47:01 2009	(r40102)
@@ -127,12 +127,16 @@
     void *ret;
     switch (hash->key_type) {
         case Hash_key_type_int:
-            ret = (void *)Parrot_str_to_int(interp, key);
+        {
+            /* Pacify compiler about casting INVTAL to void */
+            INTVAL int_key  = Parrot_str_to_int(interp, key);
+            ret             = INTVAL2PTR(void *, int_key);
             break;
+        }
         /* Currently PMCs are stringified */
         case Hash_key_type_PMC:
         case Hash_key_type_STRING:
-            ret = (void *)key;
+            ret = key;
             break;
         default:
             Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_UNIMPLEMENTED,
@@ -147,8 +151,11 @@
     void *ret;
     switch (hash->key_type) {
         case Hash_key_type_int:
-            ret = (void *)VTABLE_get_integer(interp, key);
+        {
+            INTVAL int_key  = VTABLE_get_integer(interp, key);
+            ret             = INTVAL2PTR(void *, int_key);
             break;
+        }
         /* Currently PMCs are stringified */
         case Hash_key_type_PMC:
         case Hash_key_type_STRING:
@@ -176,13 +183,13 @@
     void *ret;
     switch (hash->entry_type) {
         case enum_type_INTVAL:
-            ret = (void*)value;
+            ret = INTVAL2PTR(void *, value);
             break;
         case enum_type_PMC:
             {
                 PMC *tmp = get_integer_pmc(interp);
                 VTABLE_set_integer_native(interp, tmp, value);
-                ret = (void *)tmp;
+                ret = INTVAL2PTR(void *, tmp);
             }
             break;
         case enum_type_STRING:
@@ -201,8 +208,11 @@
     void *ret;
     switch (hash->entry_type) {
         case enum_type_INTVAL:
-            ret = (void*)Parrot_str_to_int(interp, value);
+        {
+            INTVAL int_val  = Parrot_str_to_int(interp, value);
+            ret             = INTVAL2PTR(void *, int_val);
             break;
+        }
         case enum_type_STRING:
             ret = (void *)value;
             break;
@@ -226,8 +236,11 @@
     void *ret;
     switch (hash->entry_type) {
         case enum_type_INTVAL:
-            ret = (void*)VTABLE_get_integer(interp, value);
+        {
+            INTVAL int_val  = VTABLE_get_integer(interp, value);
+            ret             = INTVAL2PTR(void *, int_val);
             break;
+        }
         case enum_type_STRING:
             ret = (void *)VTABLE_get_string(interp, value);
             break;


More information about the parrot-commits mailing list