diff --git a/ChangeLog b/ChangeLog index f495e65fd..bd70e981a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2002-05-03 Richard Frith-Macdonald + + * Source/NSAssertion.m: Added comments and fixed bug in handling + an assertion in a function ... was calling va_end() before the last + use of the arguments. + 2002-05-02 Richard Frith-Macdonald * SSL/GSUnixSSLHandle.m: Change '#if HAVE...' to '#ifdef HAVE_...' diff --git a/Source/NSAssertionHandler.m b/Source/NSAssertionHandler.m index b15700cd4..97df6a00a 100644 --- a/Source/NSAssertionHandler.m +++ b/Source/NSAssertionHandler.m @@ -37,6 +37,10 @@ /* Key for thread dictionary. */ static NSString *dict_key = @"_NSAssertionHandler"; +/** + * Returns the assertion handler object for the current thread.
+ * If none exists, creates one and returns it. + */ + (NSAssertionHandler*) currentHandler { NSMutableDictionary *dict; @@ -52,6 +56,11 @@ static NSString *dict_key = @"_NSAssertionHandler"; return handler; } +/** + * Handles an assertion failure by using NSLogv() to print an error + * message built from the supplied arguments, and then raising an + * NSInternalInconsistencyException + */ - (void) handleFailureInFunction: (NSString*)functionName file: (NSString*)fileName lineNumber: (int)line @@ -66,13 +75,18 @@ static NSString *dict_key = @"_NSAssertionHandler"; stringWithFormat: @"%@:%d Assertion failed in %@. %@", fileName, line, functionName, format]; NSLogv(message, ap); - va_end(ap); [NSException raise: NSInternalInconsistencyException format: message arguments: ap]; + va_end(ap); /* NOT REACHED */ } +/** + * Handles an assertion failure by using NSLogv() to print an error + * message built from the supplied arguments, and then raising an + * NSInternalInconsistencyException + */ - (void) handleFailureInMethod: (SEL) aSelector object: object file: (NSString *) fileName