Differences From Artifact [3d254d43a1]:
- File src/OFObject.m — part of check-in [4cd4d94ea8] at 2009-05-24 21:51:15 on branch trunk — Don't use @defs - it's not available in the ObjC2 ABI. (user: js, size: 8020) [annotate] [blame] [check-ins using]
To Artifact [8515c66c59]:
- File
src/OFObject.m
— part of check-in
[5337be0924]
at
2009-05-25 17:00:32
on branch trunk
— Improve objc_sync.m.
* Use inline functions to improve code readability.
* Fix a wrong lock.
* Initialize it in +[initialize] of OFObject. (user: js, size: 8240) [annotate] [blame] [check-ins using]
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" #include <stdlib.h> #include <string.h> #include <limits.h> #include <assert.h> #import "OFObject.h" #import "OFAutoreleasePool.h" | > | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | /* * Copyright (c) 2008 - 2009 * Jonathan Schleifer <js@webkeks.org> * * All rights reserved. * * This file is part of libobjfw. It may be distributed under the terms of the * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #include "config.h" #include <stdio.h> #include <stdlib.h> #include <string.h> #include <limits.h> #include <assert.h> #import "OFObject.h" #import "OFAutoreleasePool.h" |
︙ | ︙ | |||
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | /* Hopefully no arch needs more than 16 bytes padding */ #define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15) #define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN)) static struct { Class isa; } alloc_failed_exception; @implementation OFObject + (void)initialize { } + alloc { OFObject *instance; #ifdef __objc_INCLUDE_GNU size_t isize = class_get_instance_size(self); | > > > > > > > > > > | 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 | /* Hopefully no arch needs more than 16 bytes padding */ #define PRE_IVAR_ALIGN ((sizeof(struct pre_ivar) + 15) & ~15) #define PRE_IVAR ((struct pre_ivar*)((char*)self - PRE_IVAR_ALIGN)) static struct { Class isa; } alloc_failed_exception; #ifdef NEED_OBJC_SYNC_INIT extern BOOL objc_sync_init(); #endif @implementation OFObject + (void)initialize { #ifdef NEED_OBJC_SYNC_INIT if (!objc_sync_init()) { fputs("Runtime error: objc_sync_init() failed!\n", stderr); abort(); } #endif } + alloc { OFObject *instance; #ifdef __objc_INCLUDE_GNU size_t isize = class_get_instance_size(self); |
︙ | ︙ |