diff options
author | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-09-28 21:28:56 +0200 |
---|---|---|
committer | Matthias Benkard <mulk@minimulk.mst-plus> | 2008-09-28 21:28:56 +0200 |
commit | 90a3e20fcfe07c24533cce14e1d1dd8a5d611ed6 (patch) | |
tree | a677508c98400fc2d3ea5d06189cca0b3ca1f7f9 /MLKForeignProcedure.m | |
parent | 31eed182d7996b7dbc319bd5f2c474a734492b04 (diff) |
Use GC-aware allocation instead of malloc(3) where appropriate.
Diffstat (limited to 'MLKForeignProcedure.m')
-rw-r--r-- | MLKForeignProcedure.m | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/MLKForeignProcedure.m b/MLKForeignProcedure.m index ce4ac8a..f268005 100644 --- a/MLKForeignProcedure.m +++ b/MLKForeignProcedure.m @@ -23,6 +23,10 @@ #import <Foundation/NSArray.h> #import <Foundation/NSEnumerator.h> +#ifdef __OBJC_GC__ +#import <Foundation/NSZone.h> +#endif + #ifdef HAVE_FFI_H #include <ffi.h> #elif HAVE_FFI_FFI_H @@ -47,7 +51,11 @@ _code = code; _returnType = returnType; +#ifdef __OBJC_GC__ + _argumentTypes = NSAllocateCollectable (sizeof (MLKForeignType) * [argTypes count], NSScannedOption); +#else _argumentTypes = malloc (sizeof (MLKForeignType) * [argTypes count]); +#endif e = [argTypes objectEnumerator]; i = 0; @@ -113,10 +121,4 @@ free (_argumentTypes); [super dealloc]; } - --(void) finalize -{ - free (_argumentTypes); - [super finalize]; -} @end |