[cl-prevalence-devel] Re: bug in cl-prevalence

Sven Van Caekenberghe scaekenberghe at common-lisp.net
Fri Mar 16 15:39:28 UTC 2007


On 15 Mar 2007, at 16:43, Phlex wrote:

> Hello,
>
> I beleive I found a bug in your cl-prevalence package. It is in the  
> src/serialization.lisp file.
> Here is what i think is the correct (serialize-sexp-internal hash- 
> table ? ?) method.
>
> (defmethod serialize-sexp-internal ((object hash-table) stream  
> serialization-state)
>  (let ((id (known-object-id serialization-state object)))
>    (if id
>    (progn
>      (write-string "(:REF . " stream)
>      (prin1 id stream)
>      (write-string ")" stream))
>        (let ((count (hash-table-count object)))
>          (setf id (set-known-object serialization-state object))
>          (write-string "(:HASH-TABLE " stream)
>          (prin1 id stream)
>          (write-string " :TEST " stream)
>          (print-symbol (hash-table-test object) stream)
>          (write-string " :SIZE " stream)
>          (prin1 (hash-table-size object) stream)
>          (write-string " :REHASH-SIZE " stream)
>          (prin1 (hash-table-rehash-size object) stream)
>          (write-string " :REHASH-THRESHOLD " stream)
>          (prin1 (hash-table-rehash-threshold object) stream)
>          (unless (zerop count)
>            (write-string " :ENTRIES (" stream)
>            (maphash #'(lambda (key value)
>                         (write-string " (" stream)
>                         (serialize-sexp-internal key stream  
> serialization-state)
>                         (write-string " . " stream)
>                         (serialize-sexp-internal value stream  
> serialization-state)
>                         (princ ")" stream))
>                     object)
>            (write-string " )" stream)) ;;this line was added
>          (write-string " )" stream))))) ;;a closing parenthesis was  
> removed from the output string
>
> I hope this helps, and thanks for your work on this library.
>
> Sacha De Vos

Thanks for noticing/reporting/fixing this bug, Sascha!
I applied your change, committed it and re-released the tarball.

Sven





More information about the Cl-prevalence-devel mailing list