From 45e00ec3f4dd6289cd14021ef1ee35568b4928c6 Mon Sep 17 00:00:00 2001 From: Matthias Benkard Date: Sun, 28 Sep 2008 21:35:04 +0200 Subject: LLVM compiler: Simplify allocation of closures. --- MLKCompiledClosure.m | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'MLKCompiledClosure.m') diff --git a/MLKCompiledClosure.m b/MLKCompiledClosure.m index 6f61b45..fd643e3 100644 --- a/MLKCompiledClosure.m +++ b/MLKCompiledClosure.m @@ -45,18 +45,14 @@ #ifdef __OBJC_GC__ _data = NSAllocateCollectable (dataLength * sizeof(id), NSScannedOption); - for (i = 0; i < _dataLength; i++) - { - _data[i] = data[i]; - } - free (data); #else - _data = data; + _data = malloc (dataLength * sizeof(id)); +#endif + for (i = 0; i < _dataLength; i++) { - LRETAIN (_data[i]); + _data[i] = LRETAIN (data[i]); } -#endif return self; } -- cgit v1.2.3