From: Walter C. P. <wa...@pe...> - 2009-09-03 14:43:42
|
SXHASH, as it stands, is useless for pathnames. Please consider applying this patch to include the code from CMUCL, which looks like doing the right thing. *** target-sxhash.lisp.~1.33.~ 2009-05-15 04:18:38.000000000 +0200 --- target-sxhash.lisp 2009-09-03 16:12:13.150714653 +0200 *************** *** 182,187 **** --- 182,199 ---- (mix (sxhash-recurse (car x) (1- depthoid)) (sxhash-recurse (cdr x) (1- depthoid))) 261835505))) + (pathname + ;; Pathnames are EQUAL if all the components are EQUAL, so we + ;; hash all of the components of a pathname together. + (let ((hash (sxhash-recurse (pathname-host x) depthoid))) + (mixf hash (sxhash-recurse (pathname-device x) depthoid)) + (mixf hash (sxhash-recurse (pathname-directory x) depthoid)) + (mixf hash (sxhash-recurse (pathname-name x) depthoid)) + (mixf hash (sxhash-recurse (pathname-type x) depthoid)) + ;; Hash :newest the same as NIL because EQUAL for pathnames + ;; assumes that :newest and nil are equal. + (let ((version (%pathname-version x))) + (mixf hash (sxhash-recurse (if (eql version :newest) nil version) depthoid))))) (instance (if (or (typep x 'structure-object) (typep x 'condition)) (logxor 422371266 -- walter pelissero http://www.pelissero.de |