summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MLKCompiledClosure.h3
-rw-r--r--MLKCompiledClosure.m14
2 files changed, 4 insertions, 13 deletions
diff --git a/MLKCompiledClosure.h b/MLKCompiledClosure.h
index 589c0de..7df6c68 100644
--- a/MLKCompiledClosure.h
+++ b/MLKCompiledClosure.h
@@ -27,9 +27,8 @@
@interface MLKCompiledClosure : NSObject <MLKFuncallable>
{
int _dataLength;
- id (**_code)();
+ id (*_code)();
id *_data;
- BOOL _ownPointer; // do we own the _code pointer cell?
}
// Why intptr_t? Because it makes it easier to call this method from
diff --git a/MLKCompiledClosure.m b/MLKCompiledClosure.m
index 5dbf6dd..c2ab290 100644
--- a/MLKCompiledClosure.m
+++ b/MLKCompiledClosure.m
@@ -38,10 +38,7 @@
_data = data;
_dataLength = dataLength;
- _ownPointer = YES;
-
- _code = malloc (sizeof (id (*)()));
- *_code = code;
+ _code = code;
for (i = 0; i < _dataLength; i++)
{
@@ -89,7 +86,7 @@
format:@"FFI type is invalid (this is probably a bug)."];
}
- ffi_call (&cif, FFI_FN (*_code), &return_value, (void**)argv);
+ ffi_call (&cif, FFI_FN (_code), &return_value, (void**)argv);
// FIXME
return [NSArray arrayWithObject:nullify(return_value)];
@@ -111,16 +108,11 @@
[super dealloc];
- // FIXME: Decrease refcount of *_code. Note: When releasing *_code,
- // also release _code regardless of whether we own it.
-
+ // FIXME: Decrease refcount of _code.
for (i = 0; i < _dataLength; i++)
{
LRELEASE (_data[i]);
}
free (_data);
-
- if (_ownPointer)
- free (_code);
}
@end