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

Diff of /freeable.lisp

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

revision 1 by rklochkov, Thu Feb 9 15:53:55 2012 UTC revision 2 by rklochkov, Mon Feb 20 18:55:20 2012 UTC
# Line 9  Line 9 
9    
10  (define-foreign-type freeable-base ()  (define-foreign-type freeable-base ()
11    ((free :accessor object-free :initarg :free :initform :no-transfer    ((free :accessor object-free :initarg :free :initform :no-transfer
12           :type (member :none :all :no-transfer :transfer)           :type (member :none :all :no-transfer :transfer :container)
13           :documentation "Free returned or sent value.           :documentation "Free returned or sent value.
14  :NONE -- no free at all  :NONE -- no free at all
15  :ALL -- free always (after sending to FFI, or after recieved translation)  :ALL -- free always (after sending to FFI, or after recieved translation)
16  :TRANSFER -- client frees, so free after recieve  :TRANSFER -- client frees, so free after recieve
17  :NO-TRANSFER -- host frees, so free after sending to FFI.  :NO-TRANSFER -- host frees, so free after sending to FFI.
18    :CONTAINER -- the object is a container, ALL for container and NO-TRANSFER for
19    contained items
20  You should call FREE-RETURNED-IF-NEEDED and FREE-SENT-IF-NEEDED in  You should call FREE-RETURNED-IF-NEEDED and FREE-SENT-IF-NEEDED in
21  appropriate places of your CFFI translators")))  appropriate places of your CFFI translators")))
22    
# Line 32  appropriate places of your CFFI translat Line 34  appropriate places of your CFFI translat
34      (free-ptr type ptr)))      (free-ptr type ptr)))
35    
36  (defun free-sent-if-needed (type ptr)  (defun free-sent-if-needed (type ptr)
37    (when (member (object-free type) '(:all :no-transfer))    (when (member (object-free type) '(:all :container :no-transfer))
38      (free-sent-ptr type ptr)))      (free-sent-ptr type ptr)))
39    
40  (defun free-returned-if-needed (type ptr)  (defun free-returned-if-needed (type ptr)
41    (when (member (object-free type) '(:all :transfer))    (when (member (object-free type) '(:all :container :transfer))
42      (free-returned-ptr type ptr)))      (free-returned-ptr type ptr)))
43    
44  (defclass freeable (freeable-base) ()  (defclass freeable (freeable-base) ()

Legend:
Removed from v.1  
changed lines
  Added in v.2

  ViewVC Help
Powered by ViewVC 1.1.5