Overview
Comment: | Decided we don't want @"" anyway. Thus remove our own alloc.
We don't need it anymore as there is no reason left to have our memory |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA3-256: |
061e6540366270bc6c57a121b30579c0 |
User & Date: | js on 2008-10-25 22:28:16 |
Other Links: | manifest | tags |
Context
2008-10-25
| ||
22:34 | initWithFooString -> initAsFooString. check-in: 326b0a1c33 user: js tags: trunk | |
22:28 | Decided we don't want @"" anyway. Thus remove our own alloc. check-in: 061e654036 user: js tags: trunk | |
22:25 | newWithFooString -> newAsFooString. check-in: 62abf39400 user: js tags: trunk | |
Changes
Modified src/OFObject.h from [1d4691aa4c] to [20796294ad].
︙ | ︙ | |||
14 15 16 17 18 19 20 | struct __ofobject_allocated_mem { void *ptr; struct __ofobject_allocated_mem *prev; struct __ofobject_allocated_mem *next; }; @interface OFObject: Object | > | > | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | struct __ofobject_allocated_mem { void *ptr; struct __ofobject_allocated_mem *prev; struct __ofobject_allocated_mem *next; }; @interface OFObject: Object { struct __ofobject_allocated_mem *__mem_pool; } - init; - (void*)getMemWithSize: (size_t)size; - (void*)resizeMem: (void*)ptr toSize: (size_t)size; - (void)freeMem: (void*)ptr; - free; @end |
Modified src/OFObject.m from [5509180fd4] to [88dde3fe42].
︙ | ︙ | |||
18 19 20 21 22 23 24 | #ifdef HAVE_OBJC_RUNTIME_H #import <objc/runtime.h> #endif #import "OFObject.h" #import "OFExceptions.h" | < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < < | | | 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 | #ifdef HAVE_OBJC_RUNTIME_H #import <objc/runtime.h> #endif #import "OFObject.h" #import "OFExceptions.h" @implementation OFObject - init { if ((self = [super init]) != nil) __mem_pool = NULL; return self; } - free { struct __ofobject_allocated_mem *iter, *iter2; for (iter = __mem_pool; iter != NULL; iter = iter2) { iter2 = iter->prev; free(iter->ptr); free(iter); } free(self); |
︙ | ︙ | |||
93 94 95 96 97 98 99 | free(iter); [[OFNoMemException newWithObject: self andSize: size] raise]; return NULL; } iter->next = NULL; | | | | | | | 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 86 87 88 89 90 | free(iter); [[OFNoMemException newWithObject: self andSize: size] raise]; return NULL; } iter->next = NULL; iter->prev = __mem_pool; if (__mem_pool != NULL) __mem_pool->next = iter; __mem_pool = iter; return iter->ptr; } - (void*)resizeMem: (void*)ptr toSize: (size_t)size { struct __ofobject_allocated_mem *iter; for (iter = __mem_pool; iter != NULL; iter = iter->prev) { if (iter->ptr == ptr) { if ((ptr = realloc(iter->ptr, size)) == NULL) { [[OFNoMemException newWithObject: self andSize: size] raise]; return NULL; } |
︙ | ︙ | |||
130 131 132 133 134 135 136 | return NULL; } - (void)freeMem: (void*)ptr; { struct __ofobject_allocated_mem *iter; | | | | | 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 123 124 | return NULL; } - (void)freeMem: (void*)ptr; { struct __ofobject_allocated_mem *iter; for (iter = __mem_pool; iter != NULL; iter = iter->prev) { if (iter->ptr == ptr) { if (iter->prev != NULL) iter->prev->next = iter->next; if (iter->next != NULL) iter->next->prev = iter->prev; if (__mem_pool == iter) __mem_pool = NULL; free(iter); free(ptr); return; } } [[OFMemNotPartOfObjException newWithObject: self andPointer: ptr] raise]; } @end |