/[cffi-objects]/freeable.lisp
ViewVC logotype

Diff of /freeable.lisp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 8 by rklochkov, Sun Aug 12 17:36:30 2012 UTC revision 9 by rklochkov, Fri Aug 24 19:26:53 2012 UTC
# Line 22  Line 22 
22    
23  (defgeneric free-ptr (type ptr)  (defgeneric free-ptr (type ptr)
24    (:documentation "Called to free ptr, unless overriden free-sent-ptr    (:documentation "Called to free ptr, unless overriden free-sent-ptr
25  or free-returned-ptr.")  or free-returned-ptr. TYPE should be specialized with EQL")
26    (:method (type ptr)    (:method (type ptr)
27      (foreign-free ptr)))      (foreign-free ptr)))
28    
29  (defgeneric free-sent-ptr (type ptr param)  (defgeneric free-sent-ptr (cffi-type ptr param)
30    (:method ((type freeable-base) ptr param)    (:method ((cffi-type freeable-base) ptr param)
     (declare (ignore param))  
31      (unless (null-pointer-p ptr)      (unless (null-pointer-p ptr)
32        (free-ptr type ptr))))        (free-ptr (type-of cffi-type) ptr))))
33    
34  (defgeneric free-returned-ptr (type ptr)  (defgeneric free-returned-ptr (cffi-type ptr)
35    (:method ((type freeable-base) ptr)    (:method ((cffi-type freeable-base) ptr)
36      (unless (null-pointer-p ptr)      (unless (null-pointer-p ptr)
37        (free-ptr type ptr))))        (free-ptr (type-of cffi-type) ptr))))
38    
39  (defun free-sent-if-needed (type ptr param)  (defun free-sent-if-needed (cffi-type ptr param)
40    (when (fst-free-to-foreign-p type)    (when (fst-free-to-foreign-p cffi-type)
41      (free-sent-ptr type ptr param)))      (free-sent-ptr cffi-type ptr param)))
42    
43  (defun free-returned-if-needed (type ptr)  (defun free-returned-if-needed (cffi-type ptr)
44    (when (fst-free-from-foreign-p type)    (when (fst-free-from-foreign-p cffi-type)
45      (free-returned-ptr type ptr)))      (free-returned-ptr cffi-type ptr)))
46    
47  (defclass freeable (freeable-base) ()  (defclass freeable (freeable-base) ()
48    (:documentation "Mixing to auto-set translators"))    (:documentation "Mixing to auto-set translators"))

Legend:
Removed from v.8  
changed lines
  Added in v.9

  ViewVC Help
Powered by ViewVC 1.1.5