Differences From Artifact [85971766c6]:
- File
src/OFObject.m
— part of check-in
[7a49441656]
at
2008-10-09 00:25:31
on branch trunk
— Multiple changes, see details.
* Use config.h.
* Check whether to use sel_get_name or sel_getName.
* Rename freeWithData to freeIncludingData. (user: js, size: 2209) [annotate] [blame] [check-ins using]
To Artifact [5509180fd4]:
- File
src/OFObject.m
— part of check-in
[e47ad44290]
at
2008-10-22 13:32:19
on branch trunk
— Reworked OFObject and added append(Wide)CString to OFString.
The reworked OFObject lets one test fail on the GNU runtime.
Unfortunately, I have no idea why... (user: js, size: 3131) [annotate] [blame] [check-ins using]
︙ | |||
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | 8 9 10 11 12 13 14 15 16 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 80 81 82 83 84 85 | + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + | * Q Public License 1.0, which can be found in the file LICENSE included in * the packaging of this file. */ #import "config.h" #import <stdlib.h> #import <string.h> #import <objc/objc-api.h> #ifdef HAVE_OBJC_RUNTIME_H #import <objc/runtime.h> #endif #import "OFObject.h" #import "OFExceptions.h" #ifdef HAVE_OBJC_RUNTIME_H #define MEM_POOL (*(struct __ofobject_allocated_mem**)((char*)self + \ class_getInstanceSize([self class]))) #else #define MEM_POOL (*(struct __ofobject_allocated_mem**)((char*)self + \ ([self class])->instance_size)) #endif @implementation OFObject + alloc { Class class = [self class]; id inst = nil; #ifdef HAVE_OBJC_RUNTIME_H if ((inst = (id)malloc(class_getInstanceSize(class) + sizeof(struct __ofobject_allocated_mem*))) != nil) { memset(inst, 0, class_getInstanceSize(class) + sizeof(struct __ofobject_allocated_mem*)); inst->isa = class; } #else if ((inst = (id)malloc(class->instance_size) + sizeof(struct __ofobject_allocated_mem*)) != nil) { memset(inst, 0, class->instance_size + sizeof(struct __ofobject_allocated_mem*)); inst->class_pointer = class; } #endif return inst; } - init { if ((self = [super init]) != nil) |
︙ | |||
40 41 42 43 44 45 46 | 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 | - + - - + + - + - + | free(iter); [[OFNoMemException newWithObject: self andSize: size] raise]; return NULL; } iter->next = NULL; |
︙ | |||
77 78 79 80 81 82 83 | 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | - + - - + + - - - - - - - - - - - - - | return NULL; } - (void)freeMem: (void*)ptr; { struct __ofobject_allocated_mem *iter; |