diff options
author | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-01-24 20:00:19 +0000 |
---|---|---|
committer | gtm.daemon <gtm.daemon@7dc7ac4e-7543-0410-b95c-c1676fc8e2a3> | 2013-01-24 20:00:19 +0000 |
commit | 966d5592141816ce75a00cfacfc4a60c4ef3207f (patch) | |
tree | cda91ba71de9b5e3f73d8d252286776264397e9d | |
parent | 6af47ca6a866a1bdc045163556030f3e5ebbf11b (diff) |
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)
-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 |