Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add -[drain] to OFAutoreleasePool. |
|---|---|
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
2f85ceeed76acefca8ad95344afcf12e |
| User & Date: | js 2009-11-22 16:33:04.000 |
Context
|
2009-11-22
| ||
| 16:57 | Make it very clear that OFExceptions don't use autorelease pools. check-in: 0fbbfb7158 user: js tags: trunk | |
| 16:33 | Add -[drain] to OFAutoreleasePool. check-in: 2f85ceeed7 user: js tags: trunk | |
| 15:44 | Add -[removeObjectAtIndex] and -[removeNObjects:atIndex:] to OFArray. check-in: 0b6fc2523a user: js tags: trunk | |
Changes
Changes to src/OFAutoreleasePool.h.
| ︙ | ︙ | |||
39 40 41 42 43 44 45 46 47 48 | * * \param obj The object to add to the autorelease pool */ - addObject: (OFObject*)obj; /** * Releases all objects in the autorelease pool. */ - releaseObjects; @end | > > > > > > > > > > > > > > > > > > | 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | * * \param obj The object to add to the autorelease pool */ - addObject: (OFObject*)obj; /** * Releases all objects in the autorelease pool. * * If a garbage collector is added in the future, it will tell the GC that now * is a good time to clean up, as this is often used after a lot of objects * have been added to the pool that should be released before the next iteration * of a loop, which adds objects again. Thus, it is usually a clean up call. */ - releaseObjects; /** * Releases all objects in the autorelease pool and deallocates the pool. */ - (void)release; /** * Calling drain is equivalent to calling release. * * If a garbage collector is added in the future, it will tell the GC that now * is a good time to clean up. */ - (void)drain; @end |
Changes to src/OFAutoreleasePool.m.
| ︙ | ︙ | |||
147 148 149 150 151 152 153 154 155 156 157 158 159 160 |
return self;
[objects release];
objects = nil;
return self;
}
- retain
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
| > > > > > > > > > > | 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 |
return self;
[objects release];
objects = nil;
return self;
}
- (void)release
{
[self dealloc];
}
- (void)drain
{
[self dealloc];
}
- retain
{
@throw [OFNotImplementedException newWithClass: isa
selector: _cmd];
}
|
| ︙ | ︙ |
Changes to tests/OFArray.m.
| ︙ | ︙ | |||
72 73 74 75 76 77 78 | EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [a[0] objectAtIndex: [a[0] count]]) EXPECT_EXCEPTION(@"Detect out of range in -[removeNItems:]", OFOutOfRangeException, [a[0] removeNObjects: [a[0] count] + 1]) | | | 72 73 74 75 76 77 78 79 80 | EXPECT_EXCEPTION(@"Detect out of range in -[objectAtIndex:]", OFOutOfRangeException, [a[0] objectAtIndex: [a[0] count]]) EXPECT_EXCEPTION(@"Detect out of range in -[removeNItems:]", OFOutOfRangeException, [a[0] removeNObjects: [a[0] count] + 1]) [pool drain]; } |
Changes to tests/OFDataArray.m.
| ︙ | ︙ | |||
113 114 115 116 117 118 119 | module = @"OFDataArray"; do_tests([OFDataArray class]); module = @"OFBigDataArray"; do_tests([OFBigDataArray class]); | | | 113 114 115 116 117 118 119 120 121 | module = @"OFDataArray"; do_tests([OFDataArray class]); module = @"OFBigDataArray"; do_tests([OFBigDataArray class]); [pool drain]; } |
Changes to tests/OFDictionary.m.
| ︙ | ︙ | |||
108 109 110 111 112 113 114 | TEST(@"-[isEqual:]", ![dict isEqual: dict2] && [dict removeObjectForKey: @"key3"] && ![dict isEqual: dict2] && [dict setObject: values[0] forKey: keys[0]] && [dict isEqual: dict2]) | | | 108 109 110 111 112 113 114 115 116 | TEST(@"-[isEqual:]", ![dict isEqual: dict2] && [dict removeObjectForKey: @"key3"] && ![dict isEqual: dict2] && [dict setObject: values[0] forKey: keys[0]] && [dict isEqual: dict2]) [pool drain]; } |
Changes to tests/OFHashes.m.
| ︙ | ︙ | |||
60 61 62 63 64 65 66 | EXPECT_EXCEPTION(@"Detect invalid call of -[updateWithBuffer] #1", OFHashAlreadyCalculatedException, [md5 updateWithBuffer: "" ofSize: 1]) EXPECT_EXCEPTION(@"Detect invalid call of -[updateWithBuffer] #2", OFHashAlreadyCalculatedException, [sha1 updateWithBuffer: "" ofSize: 1]) | | | 60 61 62 63 64 65 66 67 68 | EXPECT_EXCEPTION(@"Detect invalid call of -[updateWithBuffer] #1", OFHashAlreadyCalculatedException, [md5 updateWithBuffer: "" ofSize: 1]) EXPECT_EXCEPTION(@"Detect invalid call of -[updateWithBuffer] #2", OFHashAlreadyCalculatedException, [sha1 updateWithBuffer: "" ofSize: 1]) [pool drain]; } |
Changes to tests/OFList.m.
| ︙ | ︙ | |||
64 65 66 67 68 69 70 | TEST(@"-[copy]", (list = [[list copy] autorelease]) && [[list first]->object isEqual: strings[0]] && [[list first]->next->object isEqual: strings[1]] && [[list last]->object isEqual: strings[2]]) TEST(@"-[isEqual:]", [list isEqual: [[list copy] autorelease]]) | | | 64 65 66 67 68 69 70 71 72 | TEST(@"-[copy]", (list = [[list copy] autorelease]) && [[list first]->object isEqual: strings[0]] && [[list first]->next->object isEqual: strings[1]] && [[list last]->object isEqual: strings[2]]) TEST(@"-[isEqual:]", [list isEqual: [[list copy] autorelease]]) [pool drain]; } |
Changes to tests/OFObject.m.
| ︙ | ︙ | |||
59 60 61 62 63 64 65 | toSize: 1024]) != NULL) [obj freeMemory: p]; EXPECT_EXCEPTION(@"Detect resizing of memory not allocated by object", OFMemoryNotPartOfObjectException, [obj resizeMemory: (void*)1 toSize: 1024]) | | | 59 60 61 62 63 64 65 66 67 | toSize: 1024]) != NULL) [obj freeMemory: p]; EXPECT_EXCEPTION(@"Detect resizing of memory not allocated by object", OFMemoryNotPartOfObjectException, [obj resizeMemory: (void*)1 toSize: 1024]) [pool drain]; } |
Changes to tests/OFPlugin.m.
| ︙ | ︙ | |||
29 30 31 32 33 34 35 | TestPlugin *plugin; TEST(@"+[pluginFromFile:]", (plugin = [OFPlugin pluginFromFile: @"plugin/TestPlugin"])) TEST(@"TestPlugin's -[test:]", [plugin test: 1234] == 2468) | | | 29 30 31 32 33 34 35 36 37 | TestPlugin *plugin; TEST(@"+[pluginFromFile:]", (plugin = [OFPlugin pluginFromFile: @"plugin/TestPlugin"])) TEST(@"TestPlugin's -[test:]", [plugin test: 1234] == 2468) [pool drain]; } |
Changes to tests/OFString.m.
| ︙ | ︙ | |||
335 336 337 338 339 340 341 | @"#6", OFInvalidEncodingException, [@"&#xg;" stringByXMLUnescaping]) TEST(@"-[stringByXMLUnescapingWithHandler:]", (h = [[[EntityHandler alloc] init] autorelease]) && (s[0] = [@"x&foo;y" stringByXMLUnescapingWithHandler: h]) && [s[0] isEqual: @"xbary"]) | | | 335 336 337 338 339 340 341 342 343 | @"#6", OFInvalidEncodingException, [@"&#xg;" stringByXMLUnescaping]) TEST(@"-[stringByXMLUnescapingWithHandler:]", (h = [[[EntityHandler alloc] init] autorelease]) && (s[0] = [@"x&foo;y" stringByXMLUnescapingWithHandler: h]) && [s[0] isEqual: @"xbary"]) [pool drain]; } |
Changes to tests/OFTCPSocket.m.
| ︙ | ︙ | |||
59 60 61 62 63 64 65 | TEST(@"-[writeString:]", [client writeString: @"Hello!"]) TEST(@"-[readNBytes:intoBuffer:]", [accepted readNBytes: 6 intoBuffer: buf] && !memcmp(buf, "Hello!", 6)) | | | 59 60 61 62 63 64 65 66 67 | TEST(@"-[writeString:]", [client writeString: @"Hello!"]) TEST(@"-[readNBytes:intoBuffer:]", [accepted readNBytes: 6 intoBuffer: buf] && !memcmp(buf, "Hello!", 6)) [pool drain]; } |
Changes to tests/OFThread.m.
| ︙ | ︙ | |||
49 50 51 52 53 54 55 | TEST(@"+[setObject:forTLSKey:]", [OFThread setObject: @"foo" forTLSKey: key]) TEST(@"+[objectForTLSKey:]", [[OFThread objectForTLSKey: key] isEqual: @"foo"]) | | | 49 50 51 52 53 54 55 56 57 | TEST(@"+[setObject:forTLSKey:]", [OFThread setObject: @"foo" forTLSKey: key]) TEST(@"+[objectForTLSKey:]", [[OFThread objectForTLSKey: key] isEqual: @"foo"]) [pool drain]; } |
Changes to tests/OFXMLElement.m.
| ︙ | ︙ | |||
43 44 45 46 47 48 49 | stringValue: @"b&ar"] && [[elem[1] string] isEqual: @"<foo foo='b&ar'>b&ar</foo>"]) TEST(@"-[addChild:]", [elem[0] addChild: [OFXMLElement elementWithName: @"bar"]] && [[elem[0] string] isEqual: @"<foo foo='b&ar'><bar/></foo>"]) | | | 43 44 45 46 47 48 49 50 51 | stringValue: @"b&ar"] && [[elem[1] string] isEqual: @"<foo foo='b&ar'>b&ar</foo>"]) TEST(@"-[addChild:]", [elem[0] addChild: [OFXMLElement elementWithName: @"bar"]] && [[elem[0] string] isEqual: @"<foo foo='b&ar'><bar/></foo>"]) [pool drain]; } |
Changes to tests/OFXMLParser.m.
| ︙ | ︙ | |||
182 183 184 185 186 187 188 | else [parser parseBuffer: str + j withSize: 2]; } TEST(@"Checking if everything was parsed", i == 11) | | | 182 183 184 185 186 187 188 189 190 | else [parser parseBuffer: str + j withSize: 2]; } TEST(@"Checking if everything was parsed", i == 11) [pool drain]; } |