Overview
Comment: | Add of_alloc_object(). |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
e7d16fea587a5ad6a7f0a43fb4eda44d |
User & Date: | js on 2012-03-17 15:12:27 |
Other Links: | manifest | tags |
Context
2012-03-17
| ||
15:42 | Update generators to API changes. check-in: c47efdaad4 user: js tags: trunk | |
15:12 | Add of_alloc_object(). check-in: e7d16fea58 user: js tags: trunk | |
14:26 | Move definition of __BIGGEST_ALIGNMENT__ to macros.h. check-in: 2d4a63cfcb user: js tags: trunk | |
Changes
Modified src/OFObject.h from [5a4773192e] to [9620b63ed6].
︙ | ︙ | |||
596 597 598 599 600 601 602 603 604 605 | #import "OFObject+Serialization.h" #ifdef __cplusplus extern "C" { #endif extern size_t of_pagesize; extern size_t of_num_cpus; #ifdef __cplusplus } #endif | > > | 596 597 598 599 600 601 602 603 604 605 606 607 | #import "OFObject+Serialization.h" #ifdef __cplusplus extern "C" { #endif extern size_t of_pagesize; extern size_t of_num_cpus; extern id of_alloc_object(Class class_, size_t extraSize, size_t extraAlignment, void **extra); #ifdef __cplusplus } #endif |
Modified src/OFObject.m from [ffa19d5312] to [0df01667b3].
︙ | ︙ | |||
128 129 130 131 132 133 134 135 136 137 138 139 140 141 | enumeration_mutation_handler(object); } #endif #if defined(HAVE_OBJC_ENUMERATIONMUTATION) && defined(OF_OLD_GNU_RUNTIME) extern void objc_setEnumerationMutationHandler(void(*handler)(id)); #endif const char* _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; } | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 128 129 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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | enumeration_mutation_handler(object); } #endif #if defined(HAVE_OBJC_ENUMERATIONMUTATION) && defined(OF_OLD_GNU_RUNTIME) extern void objc_setEnumerationMutationHandler(void(*handler)(id)); #endif id of_alloc_object(Class class, size_t extraSize, size_t extraAlignment, void **extra) { OFObject *instance; size_t instanceSize; instanceSize = class_getInstanceSize(class); if (OF_UNLIKELY(extraAlignment > 0)) extraAlignment = ((instanceSize + extraAlignment - 1) & ~(extraAlignment - 1)) - extraAlignment; instance = malloc(PRE_IVAR_ALIGN + instanceSize + extraAlignment + extraSize); if (OF_UNLIKELY(instance == nil)) { alloc_failed_exception.isa = [OFAllocFailedException class]; @throw (OFAllocFailedException*)&alloc_failed_exception; } ((struct pre_ivar*)instance)->retainCount = 1; ((struct pre_ivar*)instance)->firstMem = NULL; ((struct pre_ivar*)instance)->lastMem = NULL; #if !defined(OF_ATOMIC_OPS) && defined(OF_THREADS) if (OF_UNLIKELY(!of_spinlock_new( &((struct pre_ivar*)instance)->retainCountSpinlock))) { free(instance); @throw [OFInitializationFailedException exceptionWithClass: class]; } #endif instance = (OFObject*)((char*)instance + PRE_IVAR_ALIGN); instance->isa = class; memset((char*)instance + sizeof(instance->isa), 0, instanceSize - sizeof(instance->isa)); if (OF_UNLIKELY(extra != NULL)) *extra = (char*)instance + instanceSize + extraAlignment; return instance; } const char* _NSPrintForDebugger(id object) { return [[object description] cStringWithEncoding: OF_STRING_ENCODING_NATIVE]; } |
︙ | ︙ | |||
229 230 231 232 233 234 235 | + (void)initialize { } + alloc { | < < | < < < < < < < < < < < < < < < < < < < < | 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 | + (void)initialize { } + alloc { return of_alloc_object(self, 0, 0, NULL); } + new { return [[self alloc] init]; } |
︙ | ︙ |