diff options
-rw-r--r-- | DebugUtils/GTMMethodCheck.m | 10 |
1 files changed, 9 insertions, 1 deletions
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 |