[business-core] string-hash doesn't not guarantee unique hash

subtle bug here-- used string-hash to convert guid-string to a number
which is faster to use as hash key. but string-hash does not guarantee
that there are no hash collisions. it is best to use guid string
instead which is guaranteed to uniquely define a split.
pull/740/head
Christopher Lam 6 years ago
parent 6071202c0f
commit 0b386157a1

@ -129,7 +129,7 @@
((not split)
(hash-for-each (lambda (k v) (gncOwnerFree v)) ht)
(hash-clear! ht))
((hashv-ref ht (string-hash (gncSplitGetGUID split))) => identity)
((hash-ref ht (gncSplitGetGUID split)) => identity)
(else
(let ((lot (xaccSplitGetLot split))
(owner (gncOwnerNew)))
@ -138,5 +138,5 @@
(gncInvoiceGetOwner
(gncInvoiceGetInvoiceFromLot lot)))
owner))
(hashv-set! ht (string-hash (gncSplitGetGUID split)) owner)
(hash-set! ht (gncSplitGetGUID split) owner)
owner))))))

Loading…
Cancel
Save