SHOW:
|
|
- or go back to the newest paste.
| 1 | - | + (id)alloc |
| 1 | + | struct obj_layout {
|
| 2 | NSUInteger retained; | |
| 3 | - | return [self allocWithZone: NSDefaultMallocZone()]; |
| 3 | + | }; |
| 4 | - | } |
| 4 | + | |
| 5 | inline id | |
| 6 | - | + (id)allocWithZone:(NSZone *)z |
| 6 | + | NSAllocateObject(Class aClass, NSUInteger extraBytes, NSZone *zone) |
| 7 | {
| |
| 8 | - | return NSAllocateObject(self, 0, z); |
| 8 | + | int size = /* необходимое кол-во байт для хранения объекта */ |
| 9 | id new = NSZoneMalloc(zone, size); | |
| 10 | memset(new, 0, size); | |
| 11 | new = (id)&((struct obj_layout *)new)[1]; | |
| 12 | } |