]> gitweb.factorcode.org Git - factor.git/commitdiff
alien.data: remove deprecated malloc-object word
authorSlava Pestov <slava@user-64-9-237-49.googlewifi.com>
Sun, 19 Sep 2010 00:56:08 +0000 (17:56 -0700)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Tue, 21 Sep 2010 04:36:20 +0000 (21:36 -0700)
basis/alien/data/data-docs.factor
basis/alien/data/data.factor
basis/tools/deploy/config/config-docs.factor
basis/windows/com/com.factor

index 02a31976c7fd1f7a6a56fd2af0d016b06002a830..1bfaa007fc6d8db7cf9cda92753ed05053d4d29b 100644 (file)
@@ -15,8 +15,6 @@ HELP: <c-object>
 { $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." } ;
 
-{ <c-object> 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:"
index 52ccf6f6d11ed23c77cad96287aba6a0b179d8d7..ab34bf5a4e7f645775db13874210032b6176e957 100644 (file)
@@ -53,12 +53,6 @@ M: pointer <c-direct-array>
 : (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 ;
 
index 4ee9869f76b806e6469813e060021170873d571f..0b06abc29a2bf2412827c3cdf9febdce16584086 100644 (file)
@@ -46,7 +46,6 @@ $nl
     { $link heap-size }
     { $link <c-object> }
     { $link <c-array> }
-    { $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." } ;
index 094859009d75737f2238cb026b30767957fd3125..e4b6d1e85a9f559023fd99924c033fbf72a5100d 100644 (file)
@@ -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