[svn:parrot] r45400 - trunk/lib/Parrot/Ops2c

chromatic at svn.parrot.org chromatic at svn.parrot.org
Sun Apr 4 04:07:58 UTC 2010


Author: chromatic
Date: Sun Apr  4 04:07:58 2010
New Revision: 45400
URL: https://trac.parrot.org/parrot/changeset/45400

Log:
[lib] Removed an unnecessary calloc from ops initialization.

Modified:
   trunk/lib/Parrot/Ops2c/Utils.pm

Modified: trunk/lib/Parrot/Ops2c/Utils.pm
==============================================================================
--- trunk/lib/Parrot/Ops2c/Utils.pm	Sun Apr  4 04:07:55 2010	(r45399)
+++ trunk/lib/Parrot/Ops2c/Utils.pm	Sun Apr  4 04:07:58 2010	(r45400)
@@ -926,7 +926,7 @@
 
 static void store_op(PARROT_INTERP, ARGIN(op_info_t *info), int full)
 {
-    HOP * const p     = mem_gc_allocate_zeroed_typed(interp, HOP);
+    HOP * const p     = mem_gc_allocate_typed(interp, HOP);
     const size_t hidx =
         hash_str(full ? info->full_name : info->name) % OP_HASH_SIZE;
 
@@ -934,31 +934,40 @@
     p->next   = hop[hidx];
     hop[hidx] = p;
 }
+
 static int get_op(PARROT_INTERP, const char * name, int full) {
-    const HOP * p;
+    const HOP *p;
+
     const size_t hidx = hash_str(name) % OP_HASH_SIZE;
+
     if (!hop) {
-        hop = mem_gc_allocate_n_zeroed_typed(interp, OP_HASH_SIZE,HOP *);
+        hop = mem_gc_allocate_n_zeroed_typed(interp, OP_HASH_SIZE, HOP *);
         hop_init(interp);
     }
+
     for (p = hop[hidx]; p; p = p->next) {
-        if(STREQ(name, full ? p->info->full_name : p->info->name))
+        if (STREQ(name, full ? p->info->full_name : p->info->name))
             return p->info - $self->{bs}op_lib.op_info_table;
     }
+
     return -1;
 }
+
 static void hop_init(PARROT_INTERP)
 {
     size_t i;
     op_info_t * const info = $self->{bs}op_lib.op_info_table;
+
     /* store full names */
     for (i = 0; i < $self->{bs}op_lib.op_count; i++)
         store_op(interp, info + i, 1);
+
     /* plus one short name */
     for (i = 0; i < $self->{bs}op_lib.op_count; i++)
         if (get_op(interp, info[i].name, 0) == -1)
             store_op(interp, info + i, 0);
 }
+
 static void hop_deinit(PARROT_INTERP)
 {
     if (hop) {


More information about the parrot-commits mailing list