Differences From Artifact [6526cc451e]:
- File src/OFList.m — part of check-in [d68dc5201f] at 2009-08-28 00:18:54 on branch trunk — Improve -[isEqual:] of OFList. (user: js, size: 4260) [annotate] [blame] [check-ins using]
To Artifact [18ec5ebfcc]:
- File
src/OFList.m
— part of check-in
[bbf1f79b8f]
at
2009-09-08 16:06:10
on branch trunk
— New OFDictionary implementation and removal of a hack in OFList.
The new implementation is easier to use as it does automatic resizing,
but therefore it's not realtime-capable anymore. The new implementation
should also be a little bit faster.I decided to change the implementation as only very few need a
realtime-capable dictionary and those few will most likely write their
own implementation for their specific case anyway.As the new implementation no longer uses OFList, this also made it
possible to remove a hack from OFList. (user: js, size: 3923) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
18 19 20 21 22 23 24 | @implementation OFList + list { return [[[self alloc] init] autorelease]; } | < < < < < < < < < < < < < < < < < < < < | 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 | @implementation OFList + list { return [[[self alloc] init] autorelease]; } - init { self = [super init]; first = NULL; last = NULL; retain_and_release = YES; return self; } - initWithoutRetainAndRelease { self = [super init]; first = NULL; last = NULL; return self; } - (void)dealloc { of_list_object_t *iter; |
︙ | ︙ | |||
83 84 85 86 87 88 89 | return last; } - (of_list_object_t*)append: (id)obj { of_list_object_t *o; | | | 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | return last; } - (of_list_object_t*)append: (id)obj { of_list_object_t *o; o = [self allocMemoryWithSize: sizeof(of_list_object_t)]; o->object = obj; o->next = NULL; o->prev = last; if (last != NULL) last->next = o; |
︙ | ︙ | |||
107 108 109 110 111 112 113 | return o; } - (of_list_object_t*)prepend: (id)obj { of_list_object_t *o; | | | 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 | return o; } - (of_list_object_t*)prepend: (id)obj { of_list_object_t *o; o = [self allocMemoryWithSize: sizeof(of_list_object_t)]; o->object = obj; o->next = first; o->prev = NULL; if (first != NULL) first->prev = o; |
︙ | ︙ | |||
132 133 134 135 136 137 138 | } - (of_list_object_t*)insert: (id)obj before: (of_list_object_t*)listobj { of_list_object_t *o; | | | 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | } - (of_list_object_t*)insert: (id)obj before: (of_list_object_t*)listobj { of_list_object_t *o; o = [self allocMemoryWithSize: sizeof(of_list_object_t)]; o->object = obj; o->next = listobj; o->prev = listobj->prev; if (listobj->prev != NULL) listobj->prev->next = o; |
︙ | ︙ | |||
158 159 160 161 162 163 164 | } - (of_list_object_t*)insert: (id)obj after: (of_list_object_t*)listobj { of_list_object_t *o; | | | 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 | } - (of_list_object_t*)insert: (id)obj after: (of_list_object_t*)listobj { of_list_object_t *o; o = [self allocMemoryWithSize: sizeof(of_list_object_t)]; o->object = obj; o->next = listobj->next; o->prev = listobj; if (listobj->next != NULL) listobj->next->prev = o; |
︙ | ︙ | |||
242 243 244 245 246 247 248 | new = [[OFList alloc] initWithoutRetainAndRelease]; o = NULL; prev = NULL; @try { for (iter = first; iter != NULL; iter = iter->next) { | | | 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | new = [[OFList alloc] initWithoutRetainAndRelease]; o = NULL; prev = NULL; @try { for (iter = first; iter != NULL; iter = iter->next) { o = [new allocMemoryWithSize: sizeof(of_list_object_t)]; o->object = iter->object; o->next = NULL; o->prev = prev; if (new->first == NULL) new->first = o; if (prev != NULL) |
︙ | ︙ |