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

chromatic at svn.parrot.org chromatic at svn.parrot.org
Tue May 26 19:29:37 UTC 2009


Author: chromatic
Date: Tue May 26 19:29:36 2009
New Revision: 39180
URL: https://trac.parrot.org/parrot/changeset/39180

Log:
[PMC] Replaced some unnecessary calloc() calls with regular malloc() calls.

Modified:
   trunk/src/pmc/hash.pmc
   trunk/src/pmc/integer.pmc

Modified: trunk/src/pmc/hash.pmc
==============================================================================
--- trunk/src/pmc/hash.pmc	Tue May 26 19:02:45 2009	(r39179)
+++ trunk/src/pmc/hash.pmc	Tue May 26 19:29:36 2009	(r39180)
@@ -155,10 +155,11 @@
 */
 
     VTABLE void init() {
-        Parrot_Hash_attributes *attr =
-            mem_allocate_zeroed_typed(Parrot_Hash_attributes);
+        Parrot_Hash_attributes * const attr =
+            mem_allocate_typed(Parrot_Hash_attributes);
+
         PMC_data(SELF) = attr;
-        SELF.set_pointer(parrot_new_hash(INTERP));
+        attr->hash     = parrot_new_hash(INTERP);
         PObj_custom_mark_destroy_SETALL(SELF);
     }
 
@@ -219,10 +220,10 @@
         Hash *new_hash = (Hash *)ptr;
 
         PARROT_HASH(SELF)->hash = new_hash;
-        new_hash->container  = SELF;
-        if (old_hash != NULL) {
+        new_hash->container     = SELF;
+
+        if (old_hash)
             parrot_hash_destroy(INTERP, old_hash);
-        }
     }
 
 /*

Modified: trunk/src/pmc/integer.pmc
==============================================================================
--- trunk/src/pmc/integer.pmc	Tue May 26 19:02:45 2009	(r39179)
+++ trunk/src/pmc/integer.pmc	Tue May 26 19:29:36 2009	(r39180)
@@ -90,9 +90,10 @@
 
 
     VTABLE void init() {
-        Parrot_Integer_attributes* const attrs =
-            mem_allocate_zeroed_typed(Parrot_Integer_attributes);
-        attrs->iv = 0;
+        Parrot_Integer_attributes * const attrs =
+            mem_allocate_typed(Parrot_Integer_attributes);
+
+        attrs->iv      = 0;
         PMC_data(SELF) = attrs;
         PObj_active_destroy_SET(SELF);
     }


More information about the parrot-commits mailing list