develooper Front page | perl.cvs.parrot | Postings from December 2008

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

From:
chromatic
Date:
December 17, 2008 14:26
Subject:
[svn:parrot] r34051 - trunk/src/pmc
Message ID:
20081217222607.D6282CBA12@x12.develooper.com
Author: chromatic
Date: Wed Dec 17 14:26:07 2008
New Revision: 34051

Modified:
   trunk/src/pmc/orderedhash.pmc

Log:
[PMC] Fixed OrderedHash PMC's clone() vtable entry not to walk off the end of
the available hash buckets.  Much of this PMC's code should move into
src/hash.c.

Modified: trunk/src/pmc/orderedhash.pmc
==============================================================================
--- trunk/src/pmc/orderedhash.pmc	(original)
+++ trunk/src/pmc/orderedhash.pmc	Wed Dec 17 14:26:07 2008
@@ -583,7 +583,8 @@
         Hash * const h_dest = (Hash *)PMC_struct_val(dest);
         UINTVAL     i;
 
-        for (i = 0; i <= hash->mask; i++) {
+        /* see N_BUCKETS in src/hash.c; 3/4 of the available bucket slots */
+        for (i = 0; i <= ((hash->mask - 1) * 3 / 4); i++) {
             HashBucket * const b      = hash->bs + i;
             void       * const key    = b->key;
 



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About