Overview
Comment: | Init C++ ctors in -[init] instead of +[alloc]. |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
9767602af7b919139ee46b75c7385f56 |
User & Date: | js on 2012-03-06 00:13:17 |
Other Links: | manifest | tags |
Context
2012-03-06
| ||
16:05 | Add OFTLSSocket.h to ObjFW.h. check-in: b8307fa156 user: js tags: trunk | |
00:13 | Init C++ ctors in -[init] instead of +[alloc]. check-in: 9767602af7 user: js tags: trunk | |
2012-03-04
| ||
22:10 | Add missing files to Xcode project. check-in: f430322299 user: js tags: trunk | |
Changes
Modified src/OFObject.m from [76ac8473f2] to [fc6752589f].
︙ | ︙ | |||
223 224 225 226 227 228 229 | { } + alloc { OFObject *instance; size_t instanceSize = class_getInstanceSize(self); | < < | < < < < < < < < < < < < < < | 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 | { } + alloc { OFObject *instance; size_t instanceSize = class_getInstanceSize(self); if ((instance = calloc(instanceSize + PRE_IVAR_ALIGN, 1)) == NULL) { alloc_failed_exception.isa = [OFAllocFailedException class]; @throw (OFAllocFailedException*)&alloc_failed_exception; } ((struct pre_ivar*)instance)->memoryChunks = NULL; ((struct pre_ivar*)instance)->memoryChunksSize = 0; ((struct pre_ivar*)instance)->retainCount = 1; #if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) if (!of_spinlock_new( &((struct pre_ivar*)instance)->retainCountSpinlock)) { free(instance); @throw [OFInitializationFailedException exceptionWithClass: self]; } #endif instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN); instance->isa = self; return instance; } + new { return [[self alloc] init]; } |
︙ | ︙ | |||
753 754 755 756 757 758 759 760 761 762 763 764 765 766 | #endif [self inheritMethodsFromClass: [class superclass]]; } - init { return self; } - (Class)class { return isa; } | > > > > > > > > > > > > > > > > | 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 | #endif [self inheritMethodsFromClass: [class superclass]]; } - init { Class class; void (*last)(id, SEL) = NULL; for (class = isa; class != Nil; class = class_getSuperclass(class)) { void (*construct)(id, SEL); if ([class instancesRespondToSelector: cxx_construct]) { if ((construct = (void(*)(id, SEL))[class instanceMethodForSelector: cxx_construct]) != last) construct(self, cxx_construct); last = construct; } else break; } return self; } - (Class)class { return isa; } |
︙ | ︙ |