diff options
author | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-13 00:43:48 +0200 |
---|---|---|
committer | Matthias Andreas Benkard <matthias@benkard.de> | 2008-08-13 00:43:48 +0200 |
commit | f632ef49a7d5465943ac7ac7c666c0490887caad (patch) | |
tree | 155b4ef4fe9ce4c42a8e7f3c962366c849475e93 | |
parent | 5e51a3a7b0ff7044c60a57afc66738699f38e076 (diff) |
Revert "MLKCompiledClosure: Always indirect through a function pointer before doing a call."
This reverts commit dfe50b2e72ddbd0148870748975f00e7fc662314.
-rw-r--r-- | MLKCompiledClosure.h | 3 | ||||
-rw-r--r-- | MLKCompiledClosure.m | 14 |
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 |