[m-rev.] diff: Use a shallow copy for version_hash_table.copy

Paul Bone paul at bone.id.au
Thu Aug 22 22:17:01 AEST 2013

Use a shallow copy for version_hash_table.copy

The code here was written ambiguously and one could not see at a glace if a
shallow or deep copy was being used, a shallow copy was always intended.
The deep copy of a version_array is unsupported on C backends and
unnecessary slow on any other backend.

    Use the version_array.copy function (which is shallow) and make it clear
    by module qualifying the call.
 library/version_hash_table.m |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/library/version_hash_table.m b/library/version_hash_table.m
index b2765c2..6b7b3aa 100644
--- a/library/version_hash_table.m
+++ b/library/version_hash_table.m
@@ -370,7 +370,7 @@ find_slot_2(HashPred, K, NumBuckets, H) :-
 copy(HT0) = HT :-
     promise_equivalent_solutions [HT] (
         HT0 = ht(NumOccupants, MaxOccupants, HashPred, Buckets0),
-        copy(Buckets0, Buckets),
+        Buckets = version_array.copy(Buckets0),
         HT = ht(NumOccupants, MaxOccupants, HashPred, Buckets)

More information about the reviews mailing list