Tidyups and minor fixes.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@16713 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-05-13 16:00:21 +00:00
parent 0d90f831fd
commit 7771c7a940
3 changed files with 41 additions and 13 deletions

View file

@ -1,3 +1,10 @@
2003-05-13 Richard Frith-Macdonald <rfm@gnu.org>
* Source/Tools/gdnc.m: Tidy termination code.
* Source/Additions/GSMime.m: ([GSMimeDocument-copyWithZone:])
corrected implementation to do a real copy rather than just a
retain.
2003-05-13 15:57 Alexander Malmberg <alexander@malmberg.org> 2003-05-13 15:57 Alexander Malmberg <alexander@malmberg.org>
* Tools/gdnc.m (ihandler): Declare variables. * Tools/gdnc.m (ihandler): Declare variables.

View file

@ -3617,9 +3617,26 @@ static NSCharacterSet *tokenSet = nil;
return s; return s;
} }
/**
* Returns a copy of the receiver.
*/
- (id) copyWithZone: (NSZone*)z - (id) copyWithZone: (NSZone*)z
{ {
return RETAIN(self); GSMimeDocument *c = [GSMimeDocument allocWithZone: z];
c->headers = [[NSMutableArray allocWithZone: z] initWithArray: headers
copyItems: YES];
if ([content isKindOfClass: [NSArray class]] == YES)
{
c->content = [[NSMutableArray allocWithZone: z] initWithArray: content
copyItems: YES];
}
else
{
c->content = [content copy];
}
return c;
} }
- (void) dealloc - (void) dealloc

View file

@ -37,16 +37,19 @@
static void static void
ihandler(int sig) ihandler(int sig)
{ {
int i; static BOOL beenHere = NO;
char *e; BOOL action;
const char *e;
/* /*
* Reset signals to avoid recursive call of handler. * Deal with recursive call of handler.
*/ */
for (i = 0; i < NSIG; i++) if (beenHere == YES)
{ {
signal(i, SIG_DFL); abort();
} }
beenHere = YES;
/* /*
* If asked to terminate, do so cleanly. * If asked to terminate, do so cleanly.
*/ */
@ -56,29 +59,30 @@ ihandler(int sig)
} }
#ifdef DEBUG #ifdef DEBUG
i = 1; // abort() by default. action = YES; // abort() by default.
#else #else
i = 0; // kill() or exit() by default. action = NO; // exit() by default.
#endif #endif
e = getenv("CRASH_ON_ABORT"); e = getenv("CRASH_ON_ABORT");
if (e != 0) if (e != 0)
{ {
if (strcasecmp(e, "yes") == 0 || strcasecmp(e, "true") == 0) if (strcasecmp(e, "yes") == 0 || strcasecmp(e, "true") == 0)
i = 1; action = YES;
else if (strcasecmp(e, "no") == 0 || strcasecmp(e, "false") == 0) else if (strcasecmp(e, "no") == 0 || strcasecmp(e, "false") == 0)
i = 0; action = NO;
else if (isdigit(*e) && *e != '0') else if (isdigit(*e) && *e != '0')
i = 1; action = YES;
else else
i = 0; action = NO;
} }
if (i == 1) if (action == YES)
{ {
abort(); abort();
} }
else else
{ {
fprintf(stderr, "gdnc killed by signal %d\n", sig);
exit(sig); exit(sig);
} }
} }