Hello, cffi-devel!

I have found a case when cffi behaves not as documented.
The documentation in page for define-foreign-library says about load-clauses 
list that "Finally, if feature is t, this load-clause is picked 
unconditionally."

But the load-clause with feature set to T is ignored, because function 
%foreign-library-spec uses alexandria:featurep, which does consider T to be 
feature.

This patch should fix this: to return the load-clause that has feature set to 
T.

Test case:
(define-foreign-library libgraphan-wrap
  (t (:default "libgraphan-wrap")))

(equal
  (%foreign-library-spec (get-foreign-library 'libgraphan-wrap))
  (t (:default "libgraphan-wrap")))
=>
 T
--- cffi.old/src/libraries.lisp	2008-09-10 21:51:48.000000000 +0400
+++ cffi.new/src/libraries.lisp	2008-09-10 21:54:56.000000000 +0400
@@ -117,7 +117,7 @@
   (setf (gethash name *foreign-libraries*) value))
 
 (defun %foreign-library-spec (lib)
-  (assoc-if #'featurep (slot-value lib 'spec)))
+  (assoc-if (lambda (feature) (or (eq feature t) (featurep feature))) (slot-value lib 'spec)))
 
 (defun foreign-library-spec (lib)
   (second (%foreign-library-spec lib)))

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
cffi-devel mailing list
cffi-devel@common-lisp.net
http://common-lisp.net/cgi-bin/mailman/listinfo/cffi-devel

Reply via email to