Merge branch 'master' of git://factorcode.org/git/factor
commit
3e7b4e047c
|
@ -26,8 +26,7 @@ HELP: memcpy
|
||||||
|
|
||||||
HELP: check-ptr
|
HELP: check-ptr
|
||||||
{ $values { "c-ptr" "an alien address, byte array, or " { $link f } } { "checked" "an alien address or byte array with non-zero address" } }
|
{ $values { "c-ptr" "an alien address, byte array, or " { $link f } } { "checked" "an alien address or byte array with non-zero address" } }
|
||||||
{ $description "Throws an error if the input is " { $link f } ". Otherwise the object remains on the data stack. This word should be used to check the return values of " { $link malloc } " and " { $link realloc } " before use." }
|
{ $description "Throws an error if the input is " { $link f } ". Otherwise the object remains on the data stack." } ;
|
||||||
{ $error-description "Callers of " { $link malloc } " and " { $link realloc } " should use " { $link check-ptr } " to throw an error in the case of a memory allocation failure." } ;
|
|
||||||
|
|
||||||
HELP: free
|
HELP: free
|
||||||
{ $values { "alien" c-ptr } }
|
{ $values { "alien" c-ptr } }
|
||||||
|
|
|
@ -84,4 +84,4 @@ PRIVATE>
|
||||||
"void" "libc" "memcpy" { "void*" "void*" "ulong" } alien-invoke ;
|
"void" "libc" "memcpy" { "void*" "void*" "ulong" } alien-invoke ;
|
||||||
|
|
||||||
: with-malloc ( size quot -- )
|
: with-malloc ( size quot -- )
|
||||||
swap 1 calloc check-ptr swap keep free ; inline
|
swap 1 calloc swap keep free ; inline
|
||||||
|
|
|
@ -79,7 +79,7 @@ HINTS: search-buffer-until { fixnum fixnum simple-alien string } ;
|
||||||
buffer-fill zero? ;
|
buffer-fill zero? ;
|
||||||
|
|
||||||
: extend-buffer ( n buffer -- )
|
: extend-buffer ( n buffer -- )
|
||||||
2dup buffer-ptr swap realloc check-ptr
|
2dup buffer-ptr swap realloc
|
||||||
over set-buffer-ptr set-buffer-size ;
|
over set-buffer-ptr set-buffer-size ;
|
||||||
|
|
||||||
: check-overflow ( n buffer -- )
|
: check-overflow ( n buffer -- )
|
||||||
|
|
|
@ -31,7 +31,7 @@ USE: unix
|
||||||
|
|
||||||
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
|
|
||||||
: with-fork ( quot -- pid )
|
: with-fork ( child parent -- pid )
|
||||||
fork [ zero? -rot if ] keep ; inline
|
fork [ zero? -rot if ] keep ; inline
|
||||||
|
|
||||||
: prepare-execvp ( args -- cmd args )
|
: prepare-execvp ( args -- cmd args )
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
USING: alien alien.c-types byte-arrays continuations destructors
|
USING: alien alien.c-types byte-arrays continuations destructors
|
||||||
io.nonblocking io io.sockets io.sockets.impl
|
io.nonblocking io io.sockets io.sockets.impl namespaces
|
||||||
io.streams.duplex io.windows io.windows.nt io.windows.nt.backend
|
io.streams.duplex io.windows io.windows.nt io.windows.nt.backend
|
||||||
windows.winsock kernel libc math sequences threads tuples.lib ;
|
windows.winsock kernel libc math sequences threads tuples.lib ;
|
||||||
IN: io.windows.nt.sockets
|
IN: io.windows.nt.sockets
|
||||||
|
|
Loading…
Reference in New Issue