Tidied code to compile with gc=yes and older compilers

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@13970 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
nico 2002-06-25 17:23:05 +00:00
parent b4192261e0
commit c17f291ac6
7 changed files with 48 additions and 9 deletions

View file

@ -438,7 +438,9 @@ static NSMutableSet *textNodes = nil;
- (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf - (void) outputNode: (GSXMLNode*)node to: (NSMutableString*)buf
{ {
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
#endif
GSXMLNode *children = [node firstChild]; GSXMLNode *children = [node firstChild];
if ([node type] == XML_ELEMENT_NODE) if ([node type] == XML_ELEMENT_NODE)

View file

@ -1268,7 +1268,9 @@ static BOOL snuggleStart(NSString *t)
withIndent: (unsigned)ind withIndent: (unsigned)ind
to: (NSMutableString*)buf to: (NSMutableString*)buf
{ {
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
#endif
unsigned l = [str length]; unsigned l = [str length];
NSRange r = NSMakeRange(0, l); NSRange r = NSMakeRange(0, l);
unsigned i = 0; unsigned i = 0;

View file

@ -331,8 +331,10 @@
- (NSMutableDictionary*) parseDeclaration - (NSMutableDictionary*) parseDeclaration
{ {
NSMutableDictionary *d = [NSMutableDictionary dictionary]; #if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
#endif
NSMutableDictionary *d = [NSMutableDictionary dictionary];
static NSSet *qualifiers = nil; static NSSet *qualifiers = nil;
static NSSet *keep = nil; static NSSet *keep = nil;
NSMutableString *t = nil; NSMutableString *t = nil;
@ -918,7 +920,6 @@ fail:
- (NSMutableDictionary*) parseImplementation - (NSMutableDictionary*) parseImplementation
{ {
CREATE_AUTORELEASE_POOL(arp);
NSString *tmp = nil; NSString *tmp = nil;
NSString *name; NSString *name;
NSString *base = nil; NSString *base = nil;
@ -926,6 +927,7 @@ fail:
NSDictionary *methods = nil; NSDictionary *methods = nil;
NSMutableDictionary *d; NSMutableDictionary *d;
NSMutableDictionary *dict = nil; NSMutableDictionary *dict = nil;
CREATE_AUTORELEASE_POOL(arp);
/* /*
* Record any class documentation for this class * Record any class documentation for this class
@ -1042,13 +1044,13 @@ fail:
- (NSMutableDictionary*) parseInterface - (NSMutableDictionary*) parseInterface
{ {
CREATE_AUTORELEASE_POOL(arp);
NSString *name; NSString *name;
NSString *base = nil; NSString *base = nil;
NSString *category = nil; NSString *category = nil;
NSDictionary *methods = nil; NSDictionary *methods = nil;
NSMutableDictionary *d; NSMutableDictionary *d;
NSMutableDictionary *dict; NSMutableDictionary *dict;
CREATE_AUTORELEASE_POOL(arp);
dict = [NSMutableDictionary dictionaryWithCapacity: 8]; dict = [NSMutableDictionary dictionaryWithCapacity: 8];
@ -1319,7 +1321,9 @@ fail:
- (NSMutableDictionary*) parseMethodIsDeclaration: (BOOL)flag - (NSMutableDictionary*) parseMethodIsDeclaration: (BOOL)flag
{ {
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
#endif
NSMutableDictionary *method; NSMutableDictionary *method;
NSMutableString *mname; NSMutableString *mname;
NSString *token; NSString *token;
@ -1850,11 +1854,11 @@ fail:
- (NSMutableDictionary*) parseProtocol - (NSMutableDictionary*) parseProtocol
{ {
CREATE_AUTORELEASE_POOL(arp);
NSString *name; NSString *name;
NSDictionary *methods = nil; NSDictionary *methods = nil;
NSMutableDictionary *dict; NSMutableDictionary *dict;
NSMutableDictionary *d; NSMutableDictionary *d;
CREATE_AUTORELEASE_POOL(arp);
dict = [[NSMutableDictionary alloc] initWithCapacity: 8]; dict = [[NSMutableDictionary alloc] initWithCapacity: 8];
@ -2086,13 +2090,13 @@ fail:
*/ */
- (void) setupBuffer - (void) setupBuffer
{ {
CREATE_AUTORELEASE_POOL(arp);
NSString *contents; NSString *contents;
NSMutableData *data; NSMutableData *data;
unichar *end; unichar *end;
unichar *inptr; unichar *inptr;
unichar *outptr; unichar *outptr;
NSMutableArray *a; NSMutableArray *a;
CREATE_AUTORELEASE_POOL(arp);
contents = [NSString stringWithContentsOfFile: fileName]; contents = [NSString stringWithContentsOfFile: fileName];
length = [contents length]; length = [contents length];

View file

@ -1106,7 +1106,6 @@ static void print_version_and_exit ()
int main (int argc, char** argv, char** env) int main (int argc, char** argv, char** env)
{ {
CREATE_AUTORELEASE_POOL(pool);
NSUserDefaults *userDefs; NSUserDefaults *userDefs;
NSArray *args; NSArray *args;
NSMutableArray *inputFiles; NSMutableArray *inputFiles;
@ -1114,6 +1113,7 @@ int main (int argc, char** argv, char** env)
BOOL warn, fixupAllLinks; BOOL warn, fixupAllLinks;
NSString *linksMarker; NSString *linksMarker;
HTMLLinker *linker; HTMLLinker *linker;
CREATE_AUTORELEASE_POOL(pool);
#ifdef GS_PASS_ARGUMENTS #ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments:argv count:argc environment:env]; [NSProcessInfo initializeWithArguments:argv count:argc environment:env];

View file

@ -353,7 +353,6 @@
#include "AGSIndex.h" #include "AGSIndex.h"
#include "AGSHtml.h" #include "AGSHtml.h"
int int
main(int argc, char **argv, char **env) main(int argc, char **argv, char **env)
{ {
@ -537,7 +536,9 @@ main(int argc, char **argv, char **env)
up = [defs stringForKey: @"Up"]; up = [defs stringForKey: @"Up"];
#if GS_WITH_GC == 0
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
#endif
parser = [AGSParser new]; parser = [AGSParser new];
[parser setWordMap: [defs dictionaryForKey: @"WordMap"]]; [parser setWordMap: [defs dictionaryForKey: @"WordMap"]];
@ -564,11 +565,13 @@ main(int argc, char **argv, char **env)
NSDate *gDate = nil; NSDate *gDate = nil;
unsigned j; unsigned j;
#if GS_WITH_GC == 0
if (pool != nil) if (pool != nil)
{ {
RELEASE(pool); RELEASE(pool);
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
} }
#endif
/* /*
* Note the name of the header file without path or extension. * 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]]; [gFiles addObject: [hfile lastPathComponent]];
} }
} }
#if GS_WITH_GC == 0
DESTROY(pool); DESTROY(pool);
#endif
DESTROY(parser); DESTROY(parser);
DESTROY(output); DESTROY(output);
} }
@ -794,11 +799,13 @@ main(int argc, char **argv, char **env)
NSDictionary *attrs; NSDictionary *attrs;
NSDate *gDate = nil; NSDate *gDate = nil;
#if GS_WITH_GC == 0
if (arp != nil) if (arp != nil)
{ {
RELEASE(arp); RELEASE(arp);
arp = [NSAutoreleasePool new]; arp = [NSAutoreleasePool new];
} }
#endif
file = [[arg lastPathComponent] stringByDeletingPathExtension]; file = [[arg lastPathComponent] stringByDeletingPathExtension];
gsdocfile = [documentationDirectory gsdocfile = [documentationDirectory
@ -870,7 +877,9 @@ main(int argc, char **argv, char **env)
} }
} }
} }
#if GS_WITH_GC == 0
DESTROY(arp); DESTROY(arp);
#endif
/* /*
* Save project references if they have been modified. * Save project references if they have been modified.
@ -898,8 +907,7 @@ main(int argc, char **argv, char **env)
NSMutableDictionary *projects; NSMutableDictionary *projects;
NSString *systemProjects; NSString *systemProjects;
NSString *localProjects; NSString *localProjects;
CREATE_AUTORELEASE_POOL (pool);
pool = [NSAutoreleasePool new];
localProjects = [defs stringForKey: @"LocalProjects"]; localProjects = [defs stringForKey: @"LocalProjects"];
if (localProjects == nil) if (localProjects == nil)
@ -1047,7 +1055,9 @@ main(int argc, char **argv, char **env)
*/ */
[globalRefs mergeRefs: [projectRefs refs] override: YES]; [globalRefs mergeRefs: [projectRefs refs] override: YES];
#if GS_WITH_GC == 0
RELEASE(pool); RELEASE(pool);
#endif
} }
/* /*
@ -1056,7 +1066,9 @@ main(int argc, char **argv, char **env)
count = [gFiles count]; count = [gFiles count];
if (generateHtml == YES && count > 0) if (generateHtml == YES && count > 0)
{ {
#if GS_WITH_GC == 0
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
#endif
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -1069,11 +1081,13 @@ main(int argc, char **argv, char **env)
NSDate *gDate = nil; NSDate *gDate = nil;
NSDate *hDate = nil; NSDate *hDate = nil;
#if GS_WITH_GC == 0
if (pool != nil) if (pool != nil)
{ {
RELEASE(pool); RELEASE(pool);
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
} }
#endif
file = [[arg lastPathComponent] stringByDeletingPathExtension]; file = [[arg lastPathComponent] stringByDeletingPathExtension];
gsdocfile = [documentationDirectory gsdocfile = [documentationDirectory
@ -1160,7 +1174,9 @@ main(int argc, char **argv, char **env)
gsdocfile); gsdocfile);
} }
} }
#if GS_WITH_GC == 0
RELEASE(pool); RELEASE(pool);
#endif
} }
/* /*
@ -1170,7 +1186,9 @@ main(int argc, char **argv, char **env)
count = [hFiles count]; count = [hFiles count];
if (count > 0) if (count > 0)
{ {
#if GS_WITH_GC == 0
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
#endif
for (i = 0; i < count; i++) for (i = 0; i < count; i++)
{ {
@ -1178,11 +1196,14 @@ main(int argc, char **argv, char **env)
NSString *src; NSString *src;
NSString *dst; NSString *dst;
#if GS_WITH_GC == 0
if (pool != nil) if (pool != nil)
{ {
RELEASE(pool); RELEASE(pool);
pool = [NSAutoreleasePool new]; pool = [NSAutoreleasePool new];
} }
#endif
file = [file lastPathComponent]; file = [file lastPathComponent];
src = file; src = file;
@ -1351,7 +1372,9 @@ main(int argc, char **argv, char **env)
NSLog(@"No readable documentation at '%@' ... skipping", src); NSLog(@"No readable documentation at '%@' ... skipping", src);
} }
} }
#if GS_WITH_GCC == 0
RELEASE(pool); RELEASE(pool);
#endif
} }
RELEASE(outer); RELEASE(outer);

View file

@ -851,7 +851,9 @@ main(int argc, char** argv, char** env)
#endif /* !MINGW */ #endif /* !MINGW */
{ {
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(pool); CREATE_AUTORELEASE_POOL(pool);
#endif
NSUserDefaults *defs = [NSUserDefaults standardUserDefaults]; NSUserDefaults *defs = [NSUserDefaults standardUserDefaults];
/* /*

View file

@ -756,7 +756,9 @@ loader(const char *url, const char *eid, xmlParserCtxtPtr *ctxt)
- (NSString *) parseBody: (xmlNodePtr)node - (NSString *) parseBody: (xmlNodePtr)node
{ {
NSMutableString *text = [NSMutableString string]; NSMutableString *text = [NSMutableString string];
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
#endif
BOOL needContents = NO; BOOL needContents = NO;
NSMutableArray *back = [NSMutableArray arrayWithCapacity: 2]; NSMutableArray *back = [NSMutableArray arrayWithCapacity: 2];
NSMutableArray *body = [NSMutableArray arrayWithCapacity: 4]; 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 - (NSString *) parseChapter: (xmlNodePtr)node contents: (NSMutableArray *)array
{ {
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp); CREATE_AUTORELEASE_POOL(arp);
#endif
NSMutableString *text = [NSMutableString string]; NSMutableString *text = [NSMutableString string];
const char *type = node->name; const char *type = node->name;
const char *next; const char *next;
@ -4777,7 +4781,9 @@ main(int argc, char **argv, char **env)
} }
NS_ENDHANDLER NS_ENDHANDLER
} }
#if GS_WITH_GC == 0
DESTROY(arp); DESTROY(arp);
#endif
} }
} }
} }