diff --git a/basis/alien/data/data-docs.factor b/basis/alien/data/data-docs.factor index 02a31976c7..1bfaa007fc 100644 --- a/basis/alien/data/data-docs.factor +++ b/basis/alien/data/data-docs.factor @@ -15,8 +15,6 @@ HELP: { $description "Creates a byte array suitable for holding a value with the given C type." } { $errors "Throws an " { $link no-c-type } " error if the type does not exist." } ; -{ malloc-object } related-words - HELP: memory>byte-array { $values { "alien" c-ptr } { "len" "a non-negative integer" } { "byte-array" byte-array } } { $description "Reads " { $snippet "len" } " bytes starting from " { $snippet "base" } " and stores them in a new byte array." } ; @@ -28,12 +26,6 @@ HELP: malloc-array { $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } { $errors "Throws an error if the type does not exist, if the requested size is negative, if a direct specialized array class appropriate to the type is not loaded, or if memory allocation fails." } ; -HELP: malloc-object -{ $values { "type" "a C type" } { "alien" alien } } -{ $description "Allocates an unmanaged memory block large enough to hold a value of a C type." } -{ $warning "Don't forget to deallocate the memory with a call to " { $link free } "." } -{ $errors "Throws an error if the type does not exist or if memory allocation fails." } ; - HELP: malloc-byte-array { $values { "byte-array" byte-array } { "alien" alien } } { $description "Allocates an unmanaged memory block of the same size as the byte array, and copies the contents of the byte array there." } @@ -92,7 +84,6 @@ ARTICLE: "malloc" "Manual memory management" $nl "Allocating a C datum with a fixed address:" { $subsections - malloc-object malloc-byte-array } "The " { $vocab-link "libc" } " vocabulary defines several words which directly call C standard library memory management functions:" diff --git a/basis/alien/data/data.factor b/basis/alien/data/data.factor index 52ccf6f6d1..ab34bf5a4e 100644 --- a/basis/alien/data/data.factor +++ b/basis/alien/data/data.factor @@ -53,12 +53,6 @@ M: pointer : (c-object) ( type -- array ) heap-size (byte-array) ; inline -: malloc-object ( type -- alien ) - 1 swap heap-size calloc ; inline - -: (malloc-object) ( type -- alien ) - heap-size malloc ; inline - : malloc-byte-array ( byte-array -- alien ) binary-object [ nip malloc dup ] 2keep memcpy ; diff --git a/basis/tools/deploy/config/config-docs.factor b/basis/tools/deploy/config/config-docs.factor index 4ee9869f76..0b06abc29a 100644 --- a/basis/tools/deploy/config/config-docs.factor +++ b/basis/tools/deploy/config/config-docs.factor @@ -46,7 +46,6 @@ $nl { $link heap-size } { $link } { $link } - { $link malloc-object } { $link malloc-array } } "If your program looks up C types dynamically or from words which do not have a stack effect, you must enable this flag, because in these situations the C type lookup code is not folded away and the word properties must be consulted at runtime." } ; diff --git a/basis/windows/com/com.factor b/basis/windows/com/com.factor index 094859009d..e4b6d1e85a 100644 --- a/basis/windows/com/com.factor +++ b/basis/windows/com/com.factor @@ -36,10 +36,9 @@ FUNCTION: HRESULT RevokeDragDrop ( HWND hWnd ) ; FUNCTION: void ReleaseStgMedium ( LPSTGMEDIUM pmedium ) ; : com-query-interface ( interface iid -- interface' ) - [ - void* malloc-object &free - [ IUnknown::QueryInterface ole32-error ] keep *void* - ] with-destructors ; + { void* } + [ IUnknown::QueryInterface ole32-error ] + with-out-parameters ; : com-add-ref ( interface -- interface ) [ IUnknown::AddRef drop ] keep ; inline