From 966d5592141816ce75a00cfacfc4a60c4ef3207f Mon Sep 17 00:00:00 2001 From: "gtm.daemon" Date: Thu, 24 Jan 2013 20:00:19 +0000 Subject: Allow GTMMethodCheck to compile under ARC, avoiding the need for -fno-objc-arc everywhere it might be used. DELTA=9 (8 added, 0 deleted, 1 changed) --- DebugUtils/GTMMethodCheck.m | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'DebugUtils') diff --git a/DebugUtils/GTMMethodCheck.m b/DebugUtils/GTMMethodCheck.m index bbf2cf4..b31960b 100644 --- a/DebugUtils/GTMMethodCheck.m +++ b/DebugUtils/GTMMethodCheck.m @@ -80,14 +80,18 @@ void GTMMethodCheckMethodChecker(void) { // Run through all the classes looking for class methods that are // prefixed with xxGMMethodCheckMethod. If it finds one, it calls it. // See GTMMethodCheck.h to see what it does. +#if !defined(__has_feature) || !__has_feature(objc_arc) NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; +#else + @autoreleasepool { +#endif int numClasses = 0; int newNumClasses = objc_getClassList(NULL, 0); int i; Class *classes = NULL; while (numClasses < newNumClasses) { numClasses = newNumClasses; - classes = realloc(classes, sizeof(Class) * numClasses); + classes = (Class *)realloc(classes, sizeof(Class) * numClasses); _GTMDevAssert(classes, @"Unable to allocate memory for classes"); newNumClasses = objc_getClassList(classes, numClasses); } @@ -157,7 +161,11 @@ void GTMMethodCheckMethodChecker(void) { free(methods); } free(classes); +#if !defined(__has_feature) || !__has_feature(objc_arc) [pool drain]; +#else + } // @autoreleasepool +#endif } #endif // DEBUG -- cgit v1.2.3