Various minro tidyups

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14744 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-Macdonald 2002-10-12 16:12:25 +00:00
parent b9c933a295
commit 4668029a4b
3 changed files with 30 additions and 15 deletions

View file

@ -1,3 +1,9 @@
2002-10-12 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSProcessInfo.m: Make safe to reinitialise with args.
* Source/Additions/GSXML.m: Correct handling of atttribute values.
* Tools/autogsdoc.m: Initialise NSProcessInfo explicitly.
2002-10-11 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSUserDefaults.m: ([-initWithContentsOfFile:]) check to see

View file

@ -171,13 +171,18 @@ static NSMutableSet *_debug_set = nil;
void
_gnu_process_args(int argc, char *argv[], char *env[])
{
NSAutoreleasePool *arp = [NSAutoreleasePool new];
CREATE_AUTORELEASE_POOL(arp);
int i;
if (_gnu_arg_zero != 0)
{
free(_gnu_arg_zero);
}
_gnu_arg_zero = (char*)malloc(strlen(argv[0]) + 1);
strcpy(_gnu_arg_zero, argv[0]);
/* Getting the process name */
IF_NO_GC(RELEASE(_gnu_processName));
_gnu_processName = [[NSString stringWithCString: argv[0]] lastPathComponent];
IF_NO_GC(RETAIN(_gnu_processName));
@ -198,7 +203,9 @@ _gnu_process_args(int argc, char *argv[], char *env[])
else
obj_argv[added++] = str;
}
IF_NO_GC(RELEASE(_gnu_arguments));
_gnu_arguments = [[NSArray alloc] initWithObjects: obj_argv count: added];
IF_NO_GC(RELEASE(_debug_set));
_debug_set = mySet;
}
@ -252,12 +259,13 @@ _gnu_process_args(int argc, char *argv[], char *env[])
#endif
i++;
}
IF_NO_GC(RELEASE(_gnu_environment));
_gnu_environment = [[NSDictionary alloc] initWithObjects: values
forKeys: keys];
[keys release];
[values release];
IF_NO_GC(RELEASE(keys));
IF_NO_GC(RELEASE(values));
}
[arp release];
IF_NO_GC(RELEASE(arp));
}
#if !GS_FAKE_MAIN && (defined(HAVE_PROCFS) && defined(HAVE_LOAD_METHOD))
@ -753,16 +761,15 @@ int main(int argc, char *argv[], char *env[])
/**
* Fallback method. The developer must call this method to initialize
* the NSProcessInfo system if none of the system-specific hacks to
* auto initiailise it are working.
* auto-initialize it are working.
*/
+ (void) initializeWithArguments: (char**)argv
count: (int)argc
environment: (char**)env
{
if (!_gnu_processName && !_gnu_arguments && !_gnu_environment)
{
_gnu_process_args(argc, argv, env);
}
[gnustep_global_lock lock];
_gnu_process_args(argc, argv, env);
[gnustep_global_lock unlock];
}
/**

View file

@ -492,13 +492,15 @@ main(int argc, char **argv, char **env)
NSMutableArray *sFiles = nil; // Source
NSMutableArray *gFiles = nil; // GSDOC
NSMutableArray *hFiles = nil; // HTML
CREATE_AUTORELEASE_POOL(outer);
CREATE_AUTORELEASE_POOL(pool);
#if GS_WITH_GC == 0
NSAutoreleasePool *outer = nil;
NSAutoreleasePool *pool = nil;
#endif
RELEASE(pool);
#ifdef GS_PASS_ARGUMENTS
[NSProcessInfo initializeWithArguments: argv count: argc environment: env];
#if GS_WITH_GC == 0
outer = [NSAutoreleasePool new];
#endif
#ifndef HAVE_LIBXML
@ -1251,7 +1253,7 @@ main(int argc, char **argv, char **env)
file, gDate, hDate);
}
parser = [GSXMLParser parserWithContentsOfFile: gsdocfile];
[parser substituteEntities: NO];
[parser substituteEntities: YES];
[parser doValidityChecking: YES];
[parser keepBlanks: NO];
if ([parser parse] == NO)