[svn:parrot] r49176 - trunk/include/parrot

luben at svn.parrot.org luben at svn.parrot.org
Mon Sep 20 15:38:45 UTC 2010


Author: luben
Date: Mon Sep 20 15:38:45 2010
New Revision: 49176
URL: https://trac.parrot.org/parrot/changeset/49176

Log:
Fix for TT#1794

Modified:
   trunk/include/parrot/hash.h

Modified: trunk/include/parrot/hash.h
==============================================================================
--- trunk/include/parrot/hash.h	Mon Sep 20 11:00:20 2010	(r49175)
+++ trunk/include/parrot/hash.h	Mon Sep 20 15:38:45 2010	(r49176)
@@ -72,7 +72,6 @@
 };
 
 /* Utility macros - use them, do not reinvent the wheel */
-#define parrot_hash_iterate parrot_hash_iterate_linear
 
 #define parrot_hash_iterate_linear(_hash, _code)                            \
 {                                                                           \
@@ -89,7 +88,7 @@
 
 #define parrot_hash_iterate_indexed(_hash, _code)                           \
 {                                                                           \
-    INTVAL _loc;                                                            \
+    UINTVAL _loc;                                                           \
     if ((_hash)->entries){                                                  \
         for (_loc = 0; _loc <= (_hash)->mask; ++_loc) {                     \
             HashBucket *_bucket = (_hash)->index[_loc];                     \
@@ -101,6 +100,14 @@
     }                                                                       \
 }
 
+#define parrot_hash_iterate(_hash, _code)                                   \
+{                                                                           \
+    if ((_hash)->key_type == Hash_key_type_int)                             \
+        parrot_hash_iterate_indexed(_hash, _code)                           \
+    else                                                                    \
+        parrot_hash_iterate_linear(_hash, _code)                            \
+}
+
 typedef void (*value_free)(ARGFREE(void *));
 
 /* To avoid creating OrderedHashItem PMC we reuse FixedPMCArray PMC */


More information about the parrot-commits mailing list