From 3030dada14e0ccbe9d2e7ce3b6fd109872d13c49 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 21 Sep 2008 16:16:47 +0200 Subject: Fix compilation on Mac OS X 10.5. --- MLKForeignProcedure.m | 1 + 1 file changed, 1 insertion(+) (limited to 'MLKForeignProcedure.m') diff --git a/MLKForeignProcedure.m b/MLKForeignProcedure.m index b8dab83..1374924 100644 --- a/MLKForeignProcedure.m +++ b/MLKForeignProcedure.m @@ -117,5 +117,6 @@ -(void) finalize { free (_argumentTypes); + [super finalize]; } @end -- cgit v1.2.3 From 6299a2e95697c68c8b50f95e360e3ae367f6deb6 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 28 Sep 2008 00:02:43 +0200 Subject: MLKCompiledClosure, MLKForeignProcedure: Fix return value buffer type for libffi. --- MLKForeignProcedure.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'MLKForeignProcedure.m') diff --git a/MLKForeignProcedure.m b/MLKForeignProcedure.m index 1374924..ce4ac8a 100644 --- a/MLKForeignProcedure.m +++ b/MLKForeignProcedure.m @@ -67,7 +67,7 @@ ffi_type *return_type; ffi_status status; void *argv[argc]; - id return_value; + ffi_arg return_value; int i; for (i = 0; i < argc; i++) @@ -95,7 +95,7 @@ if (return_type == &ffi_type_void) return [NSArray array]; else - return [NSArray arrayWithObject:nullify (MLKLispValueWithForeignValue (&return_value, _returnType))]; + return [NSArray arrayWithObject:nullify (MLKLispValueWithForeignValue ((id*)&return_value, _returnType))]; } -(NSString *) description -- cgit v1.2.3 From 90a3e20fcfe07c24533cce14e1d1dd8a5d611ed6 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 28 Sep 2008 21:28:56 +0200 Subject: Use GC-aware allocation instead of malloc(3) where appropriate. --- MLKForeignProcedure.m | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'MLKForeignProcedure.m') diff --git a/MLKForeignProcedure.m b/MLKForeignProcedure.m index ce4ac8a..f268005 100644 --- a/MLKForeignProcedure.m +++ b/MLKForeignProcedure.m @@ -23,6 +23,10 @@ #import #import +#ifdef __OBJC_GC__ +#import +#endif + #ifdef HAVE_FFI_H #include #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 -- cgit v1.2.3