Move a few more things over to new disposable protocol
parent
adc154e06b
commit
b2a1858f8f
|
@ -19,13 +19,13 @@ C: <openssl-checksum> openssl-checksum
|
|||
|
||||
<PRIVATE
|
||||
|
||||
TUPLE: evp-md-context handle ;
|
||||
TUPLE: evp-md-context < disposable handle ;
|
||||
|
||||
: <evp-md-context> ( -- ctx )
|
||||
"EVP_MD_CTX" <c-object>
|
||||
dup EVP_MD_CTX_init evp-md-context boa ;
|
||||
evp-md-context new-disposable
|
||||
"EVP_MD_CTX" <c-object> dup EVP_MD_CTX_init >>handle ;
|
||||
|
||||
M: evp-md-context dispose
|
||||
M: evp-md-context dispose*
|
||||
handle>> EVP_MD_CTX_cleanup drop ;
|
||||
|
||||
: with-evp-md-context ( quot -- )
|
||||
|
|
|
@ -18,7 +18,7 @@ TUPLE: epoll-mx < mx events ;
|
|||
max-events epoll_create dup io-error >>fd
|
||||
max-events "epoll-event" <struct-array> >>events ;
|
||||
|
||||
M: epoll-mx dispose fd>> close-file ;
|
||||
M: epoll-mx dispose* fd>> close-file ;
|
||||
|
||||
: make-event ( fd events -- event )
|
||||
"epoll-event" <c-object>
|
||||
|
|
|
@ -17,7 +17,7 @@ TUPLE: kqueue-mx < mx events ;
|
|||
kqueue dup io-error >>fd
|
||||
max-events "kevent" <struct-array> >>events ;
|
||||
|
||||
M: kqueue-mx dispose fd>> close-file ;
|
||||
M: kqueue-mx dispose* fd>> close-file ;
|
||||
|
||||
: make-kevent ( fd filter flags -- event )
|
||||
"kevent" <c-object>
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
! Copyright (C) 2008 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: kernel accessors assocs sequences threads ;
|
||||
USING: kernel accessors assocs sequences threads destructors ;
|
||||
IN: io.backend.unix.multiplexers
|
||||
|
||||
TUPLE: mx fd reads writes ;
|
||||
TUPLE: mx < disposable fd reads writes ;
|
||||
|
||||
: new-mx ( class -- obj )
|
||||
new
|
||||
new-disposable
|
||||
H{ } clone >>reads
|
||||
H{ } clone >>writes ; inline
|
||||
|
||||
|
|
|
@ -46,13 +46,15 @@ HOOK: (pixel-format-attribute) ui-backend ( pixel-format attribute-name -- value
|
|||
|
||||
ERROR: invalid-pixel-format-attributes world attributes ;
|
||||
|
||||
TUPLE: pixel-format world handle ;
|
||||
TUPLE: pixel-format < disposable world handle ;
|
||||
|
||||
: <pixel-format> ( world attributes -- pixel-format )
|
||||
2dup (make-pixel-format)
|
||||
[ nip pixel-format boa ] [ invalid-pixel-format-attributes ] if* ;
|
||||
[ pixel-format new swap >>handle swap >>world ]
|
||||
[ invalid-pixel-format-attributes ]
|
||||
?if ;
|
||||
|
||||
M: pixel-format dispose
|
||||
M: pixel-format dispose*
|
||||
[ (free-pixel-format) ] [ f >>handle drop ] bi ;
|
||||
|
||||
: pixel-format-attribute ( pixel-format attribute-name -- value )
|
||||
|
|
Loading…
Reference in New Issue