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
{
#if GS_WITH_GC == 0
CREATE_AUTORELEASE_POOL(arp);
#endif
GSXMLNode *children = [node firstChild];
if ([node type] == XML_ELEMENT_NODE)

View file

@ -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;

View file

@ -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];

View file

@ -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];

View file

@ -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);

View file

@ -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];
/*

View file

@ -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
}
}
}