229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
size_t count = _array.count;
id *copy;
if (range.length > SIZE_MAX - range.location ||
range.location >= count || range.length > count - range.location)
@throw [OFOutOfRangeException exception];
copy = of_alloc(range.length, sizeof(*copy));
memcpy(copy, objects + range.location, range.length * sizeof(id));
@try {
[_array removeItemsInRange: range];
_mutations++;
for (size_t i = 0; i < range.length; i++)
[copy[i] release];
} @finally {
free(copy);
}
}
- (void)removeLastObject
{
#ifndef __clang_analyzer__
size_t count = _array.count;
|
|
|
|
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
|
size_t count = _array.count;
id *copy;
if (range.length > SIZE_MAX - range.location ||
range.location >= count || range.length > count - range.location)
@throw [OFOutOfRangeException exception];
copy = OFAllocMemory(range.length, sizeof(*copy));
memcpy(copy, objects + range.location, range.length * sizeof(id));
@try {
[_array removeItemsInRange: range];
_mutations++;
for (size_t i = 0; i < range.length; i++)
[copy[i] release];
} @finally {
OFFreeMemory(copy);
}
}
- (void)removeLastObject
{
#ifndef __clang_analyzer__
size_t count = _array.count;
|