Avoid recursion in NSLog

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@20923 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2005-03-18 09:42:54 +00:00
parent 51376a9b9e
commit 55c351cfdf
3 changed files with 163 additions and 282 deletions

View file

@ -1,3 +1,8 @@
2005-03-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPathUtilities.m: Use fprintf rather than NSLog to try to
avoid possible recursion when errors occur.
2005-03-17 Richard Frith-Macdonald <rfm@gnu.org> 2005-03-17 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPathUtilities.m: Tidy variable and function names to fit * Source/NSPathUtilities.m: Tidy variable and function names to fit

View file

@ -114,6 +114,15 @@
#define MGR() [NSFileManager defaultManager] #define MGR() [NSFileManager defaultManager]
/*
* NB. use fprintf() rather than NSLog() to avoid possibility of recursion
* when features of NSLog() cause patrh utilities to be used.
*/
#define PrintOnce(format, args...) \
do { static BOOL beenHere = NO; if (beenHere == NO) {\
beenHere = YES; \
fprintf(stderr, format, ## args); }} while (0)
/* ------------------ */ /* ------------------ */
/* Internal variables */ /* Internal variables */
/* ------------------ */ /* ------------------ */
@ -334,9 +343,9 @@ static NSString *setUserGNUstepPath(NSString *userName,
dict = GSReadStepConfFile(steprcFile); dict = GSReadStepConfFile(steprcFile);
if (dict != nil) if (dict != nil)
{ {
GSOnceFLog(@"Warning: Configuration: The file %s has been " PrintOnce("Warning: Configuration: The file %s has been "
@"deprecated. Please use the configuration file %s to " "deprecated. Please use the configuration file %s to "
@"set standard paths.\n", "set standard paths.\n",
[steprcFile fileSystemRepresentation], [steprcFile fileSystemRepresentation],
stringify(GNUSTEP_CONFIGURATION_FILE)); stringify(GNUSTEP_CONFIGURATION_FILE));
forceD = [[dict objectForKey: @"FORCE_DEFAULTS_ROOT"] boolValue]; forceD = [[dict objectForKey: @"FORCE_DEFAULTS_ROOT"] boolValue];
@ -444,27 +453,27 @@ static void InitialisePathUtilities(void)
o = [d objectForKey: @"FORCE_DEFAULTS_ROOT"]; o = [d objectForKey: @"FORCE_DEFAULTS_ROOT"];
if (o != nil) if (o != nil)
{ {
GSOnceFLog(@"Warning: Configuration: " PrintOnce("Warning: Configuration: "
"FORCE_DEFAULTS_ROOT is deprecated.\n"); "FORCE_DEFAULTS_ROOT is deprecated.\n");
forceD = [o boolValue]; forceD = [o boolValue];
} }
o = [d objectForKey: @"FORCE_USER_ROOT"]; o = [d objectForKey: @"FORCE_USER_ROOT"];
if (o != nil) if (o != nil)
{ {
GSOnceFLog(@"Warning: Configuration: " PrintOnce("Warning: Configuration: "
"FORCE_USER_ROOT is deprecated.\n"); "FORCE_USER_ROOT is deprecated.\n");
forceU = [o boolValue]; forceU = [o boolValue];
} }
ASSIGN(oldDRoot, [d objectForKey: @"GNUSTEP_DEFAULTS_ROOT"]); ASSIGN(oldDRoot, [d objectForKey: @"GNUSTEP_DEFAULTS_ROOT"]);
if (oldDRoot != nil) if (oldDRoot != nil)
{ {
GSOnceFLog(@"Warning: Configuration: " PrintOnce("Warning: Configuration: "
"GNUSTEP_DEFAULTS_ROOT is deprecated.\n"); "GNUSTEP_DEFAULTS_ROOT is deprecated.\n");
} }
ASSIGN(oldURoot, [d objectForKey: @"GNUSTEP_USER_ROOT"]); ASSIGN(oldURoot, [d objectForKey: @"GNUSTEP_USER_ROOT"]);
if (oldURoot != nil) if (oldURoot != nil)
{ {
GSOnceFLog(@"Warning: Configuration: " PrintOnce("Warning: Configuration: "
"GNUSTEP_USER_ROOT is deprecated.\n"); "GNUSTEP_USER_ROOT is deprecated.\n");
} }
} }

417
configure vendored

File diff suppressed because it is too large Load diff