Differences From Artifact [a923c5af53]:
- File
src/OFMutableArray_adjacent.m
— part of check-in
[008be86a16]
at
2012-03-12 11:54:22
on branch trunk
— OFArray: +[arrayWithCArray:length:] -> +[arrayWithObjects:count:].
This is required for the new array literals. (user: js, size: 6556) [annotate] [blame] [check-ins using] [more...]
To Artifact [489af893ca]:
- File
src/OFMutableArray_adjacent.m
— part of check-in
[f7576a66ce]
at
2012-06-06 13:47:52
on branch trunk
— Slightly change the memory management API.
Also fix a bug where OFBigDataArray would waste memory. (user: js, size: 6049) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
38 39 40 41 42 43 44 | { [array addItem: &object]; [object retain]; mutations++; } | | | | | | 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | { [array addItem: &object]; [object retain]; mutations++; } - (void)insertObject: (id)object atIndex: (size_t)index { [array insertItem: &object atIndex: index]; [object retain]; mutations++; } - (void)replaceObject: (id)oldObject withObject: (id)newObject |
︙ | ︙ | |||
141 142 143 144 145 146 147 | id object = [self objectAtIndex: index]; [array removeItemAtIndex: index]; [object release]; mutations++; } | < < < < < < < < < < < < < < < < < < < < < < < | | | < | | | 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 188 189 190 191 192 193 194 195 196 197 198 199 | id object = [self objectAtIndex: index]; [array removeItemAtIndex: index]; [object release]; mutations++; } - (void)removeAllObjects { id *objects = [array cArray]; size_t i, count = [array count]; for (i = 0; i < count; i++) [objects[i] release]; [array removeAllItems]; } - (void)removeObjectsInRange: (of_range_t)range { id *objects = [array cArray], *copy; size_t i, count = [array count]; if (range.length > count - range.start) @throw [OFOutOfRangeException exceptionWithClass: isa]; copy = [self allocMemoryWithItemSize: sizeof(*copy) count: range.length]; memcpy(copy, objects + range.start, range.length * sizeof(id)); @try { [array removeItemsInRange: range]; mutations++; for (i = 0; i < range.length; i++) [copy[i] release]; } @finally { [self freeMemory: copy]; } } - (void)removeLastObject { id object = [self objectAtIndex: [array count] - 1]; [array removeLastItem]; [object release]; mutations++; } - (void)exchangeObjectAtIndex: (size_t)index1 withObjectAtIndex: (size_t)index2 { id *objects = [array cArray]; size_t count = [array count]; id tmp; if (index1 >= count || index2 >= count) @throw [OFOutOfRangeException exceptionWithClass: isa]; |
︙ | ︙ |