diff --git a/ChangeLog b/ChangeLog index a4829c9a8..7e101a628 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,23 @@ +Wed Nov 12 10:10:33 1997 Adam Fedor + + * src/NSString.m (-initWithFormat:args:): Print a "null string" + when string in format is nil. + * src/objc-load.c: Remove ifdef HAVE_CONFIG_H. + +Wed Nov 12 12:30:00 1997 Richard Frith-Macdonald + + * src/Collection.m: ([Enumerator -dealloc]) added call dealloction + method in super class to fix memory leak. + + * src/KeyedCollection.m: Removed initialisation and deallocation + methods for KeyEnumerator as these are done in its super class. + + * src/NSCharacterSet.m: ([-invertedSet:]) added autorelease for data + object (created by mutableCopy) in order to fix memory leak. + + * src/NSData.m: Replaced line accidentally deleted in section only + compiled in for systems without shared memory. + Thu Nov 6 19:00:00 1997 Richard Frith-Macdonald * Tools/Makefile.postamble: Modified to install gdomap in cpu/os diff --git a/Source/Collection.m b/Source/Collection.m index 7e5ac803b..26dc1d13e 100644 --- a/Source/Collection.m +++ b/Source/Collection.m @@ -34,8 +34,12 @@ - initWithCollection: coll { - collection = [coll retain]; - enum_state = [coll newEnumState]; + self = [super init]; + if (self) + { + collection = [coll retain]; + enum_state = [coll newEnumState]; + } return self; } @@ -48,6 +52,7 @@ { [collection freeEnumState: &enum_state]; [collection release]; + [super dealloc]; } @end diff --git a/Source/KeyedCollection.m b/Source/KeyedCollection.m index 89177e8b6..b47270d1e 100644 --- a/Source/KeyedCollection.m +++ b/Source/KeyedCollection.m @@ -31,13 +31,6 @@ @implementation KeyEnumerator -- initWithCollection: coll -{ - collection = [coll retain]; - enum_state = [coll newEnumState]; - return self; -} - - nextObject { id k; @@ -45,17 +38,6 @@ return k; } -- (void) dealloc -{ - [collection freeEnumState: &enum_state]; - [collection release]; -/* xxx - * I don't understand this - but calling [super dealloc] screws up - * so we use NSDeallocateObject() instead. - */ - NSDeallocateObject(self); -} - @end @implementation ConstantKeyedCollection diff --git a/Source/NSCharacterSet.m b/Source/NSCharacterSet.m index b82e079f2..0e7bc12dd 100644 --- a/Source/NSCharacterSet.m +++ b/Source/NSCharacterSet.m @@ -311,8 +311,9 @@ static NSLock* cache_lock = nil; { int i, length; char *bytes; - NSMutableData *bitmap = [[self bitmapRepresentation] mutableCopy]; + NSMutableData *bitmap; + bitmap = [[[self bitmapRepresentation] mutableCopy] autorelease]; length = [bitmap length]; bytes = [bitmap mutableBytes]; for (i=0; i < length; i++) diff --git a/Source/NSData.m b/Source/NSData.m index c0558983c..1107e8128 100644 --- a/Source/NSData.m +++ b/Source/NSData.m @@ -774,6 +774,7 @@ readContentsOfFile(NSString* path, void** buf, unsigned* len) autorelease]; #else return [[[NSDataMalloc alloc] initWithBytes:bytes length:length] + autorelease]; #endif } diff --git a/Source/NSString.m b/Source/NSString.m index 9a94def8a..1c7e40ad9 100644 --- a/Source/NSString.m +++ b/Source/NSString.m @@ -427,6 +427,8 @@ handle_printf_atsign (FILE *stream, } /* Get a C-string (char*) from the String object, and print it. */ cstring = [[(id) va_arg (arg_list, id) description] cStringNoCopy]; + if (!cstring) + cstring = ""; strcat (buf+printed_len, cstring); printed_len += strlen (cstring); /* Skip over this `%@', and look for another one. */ diff --git a/Source/objc-load.c b/Source/objc-load.c index f86b9212e..2a35aeb78 100644 --- a/Source/objc-load.c +++ b/Source/objc-load.c @@ -33,9 +33,7 @@ #include #include #include -#ifdef HAVE_CONFIG_H -#include -#endif +#include #include /* include the interface to the dynamic linker */