There are two overloadings of Next. One is a selector function to return the
next node in the current bucket, the other navigates to the next element in the
container. The implementation of Generic_Equal needs to call the former, as it
interrogates the items in each bucket.
Also, the buckets array in a bounded form is 1-based, not 0-based. Iteration
over the array incorrectly initialized the index to 0 instead of 1.
Tested on x86_64-pc-linux-gnu, committed on trunk
2011-08-29 Matthew Heaney <[email protected]>
* a-chtgbo.adb (Generic_Equal): Use correct overloading of Next.
Index: a-chtgbo.adb
===================================================================
--- a-chtgbo.adb (revision 178155)
+++ a-chtgbo.adb (working copy)
@@ -6,7 +6,7 @@
-- --
-- B o d y --
-- --
--- Copyright (C) 2004-2010, Free Software Foundation, Inc. --
+-- Copyright (C) 2004-2011, Free Software Foundation, Inc. --
-- --
-- GNAT is free software; you can redistribute it and/or modify it under --
-- terms of the GNU General Public License as published by the Free Soft- --
@@ -296,7 +296,7 @@
-- Find the first node of hash table L
- L_Index := 0;
+ L_Index := L.Buckets'First;
loop
L_Node := L.Buckets (L_Index);
exit when L_Node /= 0;
@@ -314,7 +314,7 @@
N := N - 1;
- L_Node := Next (L, L_Node);
+ L_Node := Next (L.Nodes (L_Node));
if L_Node = 0 then
-- We have exhausted the nodes in this bucket