[svn:parrot] r48687 - trunk/src

cotto at svn.parrot.org cotto at svn.parrot.org
Fri Aug 27 06:43:40 UTC 2010


Author: cotto
Date: Fri Aug 27 06:43:39 2010
New Revision: 48687
URL: https://trac.parrot.org/parrot/changeset/48687

Log:
use hash iteration macro in destroy function, patch courtesy of luben++

Modified:
   trunk/src/hash.c

Modified: trunk/src/hash.c
==============================================================================
--- trunk/src/hash.c	Fri Aug 27 06:35:53 2010	(r48686)
+++ trunk/src/hash.c	Fri Aug 27 06:43:39 2010	(r48687)
@@ -1085,14 +1085,9 @@
     ASSERT_ARGS(parrot_chash_destroy_values)
     UINTVAL i;
 
-    for (i = 0; i <= hash->mask; ++i) {
-        HashBucket *bucket = hash->index[i];
-        while (bucket) {
-            mem_gc_free(interp, bucket->key);
-            func(bucket->value);
-            bucket = bucket->next;
-        }
-    }
+    parrot_hash_iterate(hash,
+        mem_gc_free(interp, _bucket->key);
+    );
 
     parrot_hash_destroy(interp, hash);
 }


More information about the parrot-commits mailing list