diff --git a/Tools/AGSHtml.m b/Tools/AGSHtml.m index 83fdb44a7..336ff8b15 100644 --- a/Tools/AGSHtml.m +++ b/Tools/AGSHtml.m @@ -438,7 +438,9 @@ static NSMutableSet *textNodes = nil; - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf { +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(arp); +#endif GSXMLNode *children = [node firstChild]; if ([node type] == XML_ELEMENT_NODE) diff --git a/Tools/AGSOutput.m b/Tools/AGSOutput.m index 394d42670..125fc1eae 100644 --- a/Tools/AGSOutput.m +++ b/Tools/AGSOutput.m @@ -1268,7 +1268,9 @@ static BOOL snuggleStart(NSString *t) withIndent: (unsigned)ind to: (NSMutableString*)buf { +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(arp); +#endif unsigned l = [str length]; NSRange r = NSMakeRange(0, l); unsigned i = 0; diff --git a/Tools/AGSParser.m b/Tools/AGSParser.m index 869b36b7f..6ac4e0c25 100644 --- a/Tools/AGSParser.m +++ b/Tools/AGSParser.m @@ -331,8 +331,10 @@ - (NSMutableDictionary*) parseDeclaration { - NSMutableDictionary *d = [NSMutableDictionary dictionary]; +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(arp); +#endif + NSMutableDictionary *d = [NSMutableDictionary dictionary]; static NSSet *qualifiers = nil; static NSSet *keep = nil; NSMutableString *t = nil; @@ -918,7 +920,6 @@ fail: - (NSMutableDictionary*) parseImplementation { - CREATE_AUTORELEASE_POOL(arp); NSString *tmp = nil; NSString *name; NSString *base = nil; @@ -926,6 +927,7 @@ fail: NSDictionary *methods = nil; NSMutableDictionary *d; NSMutableDictionary *dict = nil; + CREATE_AUTORELEASE_POOL(arp); /* * Record any class documentation for this class @@ -1042,13 +1044,13 @@ fail: - (NSMutableDictionary*) parseInterface { - CREATE_AUTORELEASE_POOL(arp); NSString *name; NSString *base = nil; NSString *category = nil; NSDictionary *methods = nil; NSMutableDictionary *d; NSMutableDictionary *dict; + CREATE_AUTORELEASE_POOL(arp); dict = [NSMutableDictionary dictionaryWithCapacity: 8]; @@ -1319,7 +1321,9 @@ fail: - (NSMutableDictionary*) parseMethodIsDeclaration: (BOOL)flag { +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(arp); +#endif NSMutableDictionary *method; NSMutableString *mname; NSString *token; @@ -1850,11 +1854,11 @@ fail: - (NSMutableDictionary*) parseProtocol { - CREATE_AUTORELEASE_POOL(arp); NSString *name; NSDictionary *methods = nil; NSMutableDictionary *dict; NSMutableDictionary *d; + CREATE_AUTORELEASE_POOL(arp); dict = [[NSMutableDictionary alloc] initWithCapacity: 8]; @@ -2086,13 +2090,13 @@ fail: */ - (void) setupBuffer { - CREATE_AUTORELEASE_POOL(arp); NSString *contents; NSMutableData *data; unichar *end; unichar *inptr; unichar *outptr; NSMutableArray *a; + CREATE_AUTORELEASE_POOL(arp); contents = [NSString stringWithContentsOfFile: fileName]; length = [contents length]; diff --git a/Tools/HTMLLinker.m b/Tools/HTMLLinker.m index db6f43382..349f43242 100644 --- a/Tools/HTMLLinker.m +++ b/Tools/HTMLLinker.m @@ -1106,7 +1106,6 @@ static void print_version_and_exit () int main (int argc, char** argv, char** env) { - CREATE_AUTORELEASE_POOL(pool); NSUserDefaults *userDefs; NSArray *args; NSMutableArray *inputFiles; @@ -1114,6 +1113,7 @@ int main (int argc, char** argv, char** env) BOOL warn, fixupAllLinks; NSString *linksMarker; HTMLLinker *linker; + CREATE_AUTORELEASE_POOL(pool); #ifdef GS_PASS_ARGUMENTS [NSProcessInfo initializeWithArguments:argv count:argc environment:env]; diff --git a/Tools/autogsdoc.m b/Tools/autogsdoc.m index d3ada5ff2..495588de2 100644 --- a/Tools/autogsdoc.m +++ b/Tools/autogsdoc.m @@ -353,7 +353,6 @@ #include "AGSIndex.h" #include "AGSHtml.h" - int main(int argc, char **argv, char **env) { @@ -537,7 +536,9 @@ main(int argc, char **argv, char **env) up = [defs stringForKey: @"Up"]; +#if GS_WITH_GC == 0 pool = [NSAutoreleasePool new]; +#endif parser = [AGSParser new]; [parser setWordMap: [defs dictionaryForKey: @"WordMap"]]; @@ -564,11 +565,13 @@ main(int argc, char **argv, char **env) NSDate *gDate = nil; unsigned j; +#if GS_WITH_GC == 0 if (pool != nil) { RELEASE(pool); pool = [NSAutoreleasePool new]; } +#endif /* * Note the name of the header file without path or extension. @@ -775,7 +778,9 @@ main(int argc, char **argv, char **env) [gFiles addObject: [hfile lastPathComponent]]; } } +#if GS_WITH_GC == 0 DESTROY(pool); +#endif DESTROY(parser); DESTROY(output); } @@ -794,11 +799,13 @@ main(int argc, char **argv, char **env) NSDictionary *attrs; NSDate *gDate = nil; +#if GS_WITH_GC == 0 if (arp != nil) { RELEASE(arp); arp = [NSAutoreleasePool new]; } +#endif file = [[arg lastPathComponent] stringByDeletingPathExtension]; gsdocfile = [documentationDirectory @@ -870,7 +877,9 @@ main(int argc, char **argv, char **env) } } } +#if GS_WITH_GC == 0 DESTROY(arp); +#endif /* * Save project references if they have been modified. @@ -898,8 +907,7 @@ main(int argc, char **argv, char **env) NSMutableDictionary *projects; NSString *systemProjects; NSString *localProjects; - - pool = [NSAutoreleasePool new]; + CREATE_AUTORELEASE_POOL (pool); localProjects = [defs stringForKey: @"LocalProjects"]; if (localProjects == nil) @@ -1047,7 +1055,9 @@ main(int argc, char **argv, char **env) */ [globalRefs mergeRefs: [projectRefs refs] override: YES]; +#if GS_WITH_GC == 0 RELEASE(pool); +#endif } /* @@ -1056,7 +1066,9 @@ main(int argc, char **argv, char **env) count = [gFiles count]; if (generateHtml == YES && count > 0) { +#if GS_WITH_GC == 0 pool = [NSAutoreleasePool new]; +#endif for (i = 0; i < count; i++) { @@ -1069,11 +1081,13 @@ main(int argc, char **argv, char **env) NSDate *gDate = nil; NSDate *hDate = nil; +#if GS_WITH_GC == 0 if (pool != nil) { RELEASE(pool); pool = [NSAutoreleasePool new]; } +#endif file = [[arg lastPathComponent] stringByDeletingPathExtension]; gsdocfile = [documentationDirectory @@ -1160,7 +1174,9 @@ main(int argc, char **argv, char **env) gsdocfile); } } +#if GS_WITH_GC == 0 RELEASE(pool); +#endif } /* @@ -1170,7 +1186,9 @@ main(int argc, char **argv, char **env) count = [hFiles count]; if (count > 0) { +#if GS_WITH_GC == 0 pool = [NSAutoreleasePool new]; +#endif for (i = 0; i < count; i++) { @@ -1178,11 +1196,14 @@ main(int argc, char **argv, char **env) NSString *src; NSString *dst; +#if GS_WITH_GC == 0 if (pool != nil) { RELEASE(pool); pool = [NSAutoreleasePool new]; } +#endif + file = [file lastPathComponent]; src = file; @@ -1351,7 +1372,9 @@ main(int argc, char **argv, char **env) NSLog(@"No readable documentation at '%@' ... skipping", src); } } +#if GS_WITH_GCC == 0 RELEASE(pool); +#endif } RELEASE(outer); diff --git a/Tools/gdnc.m b/Tools/gdnc.m index 462458a78..01d167a0e 100644 --- a/Tools/gdnc.m +++ b/Tools/gdnc.m @@ -851,7 +851,9 @@ main(int argc, char** argv, char** env) #endif /* !MINGW */ { +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(pool); +#endif NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; /* diff --git a/Tools/gsdoc.m b/Tools/gsdoc.m index dbc3f52b2..10921d274 100644 --- a/Tools/gsdoc.m +++ b/Tools/gsdoc.m @@ -756,7 +756,9 @@ loader(const char *url, const char *eid, xmlParserCtxtPtr *ctxt) - (NSString *) parseBody: (xmlNodePtr)node { NSMutableString *text = [NSMutableString string]; +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(arp); +#endif BOOL needContents = NO; NSMutableArray *back = [NSMutableArray arrayWithCapacity: 2]; NSMutableArray *body = [NSMutableArray arrayWithCapacity: 4]; @@ -882,7 +884,9 @@ loader(const char *url, const char *eid, xmlParserCtxtPtr *ctxt) - (NSString *) parseChapter: (xmlNodePtr)node contents: (NSMutableArray *)array { +#if GS_WITH_GC == 0 CREATE_AUTORELEASE_POOL(arp); +#endif NSMutableString *text = [NSMutableString string]; const char *type = node->name; const char *next; @@ -4777,7 +4781,9 @@ main(int argc, char **argv, char **env) } NS_ENDHANDLER } +#if GS_WITH_GC == 0 DESTROY(arp); +#endif } } }