Differences From Artifact [42a1c16a8e]:
- File tests/OFAutoreleasePool/OFAutoreleasePool.m — part of check-in [e73e76e40f] at 2009-03-04 20:49:21 on branch trunk — - release should not be chained, might be free'd. Therefore return void. (user: js, size: 1327) [annotate] [blame] [check-ins using]
To Artifact [5d50ad0603]:
- File
tests/OFAutoreleasePool/OFAutoreleasePool.m
— part of check-in
[cbdd534337]
at
2009-04-12 14:51:00
on branch trunk
— Get rid of the dependency on Object.
This allows libobjfw to run on ObjC2-only runtimes like the one on the
iPhone. However, it's still relying on objc_msgSendv for plugins, which
is unavailable in ObjC2-only runtimes, thus OFPlugins are unavailable
on the iPhone until I write a replacement for objc_msgSendv. (user: js, size: 1677) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 | #ifndef _WIN32 #define ZD "%zd" #else #define ZD "%u" #endif @interface TestObject: OFObject - init; - retain; - (void)release; @end @implementation TestObject - init { id ret; | > > > > | | | > | > > > > | 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 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 67 68 69 70 71 72 73 74 75 76 77 78 79 | #ifndef _WIN32 #define ZD "%zd" #else #define ZD "%u" #endif IMP init; IMP retain; IMP release; @interface TestObject: OFObject - init; - retain; - (void)release; @end @implementation TestObject - init { id ret; ret = init(self, @selector(init)); printf("New %s with retain cnt " ZD "\n", [self name], [ret retainCount]); return ret; } - retain { id ret; ret = retain(self, @selector(retain)); printf("Retaining %s to " ZD "\n", [self name], [ret retainCount]); return ret; } - (void)release { printf("Releasing %s to " ZD "\n", [self name], [self retainCount] - 1); release(self, @selector(release)); } @end int main() { init = [OFObject replaceMethod: @selector(init) withMethodFromClass: [TestObject class]]; retain = [OFObject replaceMethod: @selector(retain) withMethodFromClass: [TestObject class]]; release = [OFObject replaceMethod: @selector(release) withMethodFromClass: [TestObject class]]; OFObject *o1, *o2, *o3; OFAutoreleasePool *pool1, *pool2; o1 = [[OFObject new] autorelease]; pool1 = [OFAutoreleasePool new]; |
︙ | ︙ |