Differences From Artifact [6e7407d49b]:
- File src/OFArray.m — part of check-in [7aa23887d0] at 2020-11-07 10:38:49 on branch trunk — Make GCC happy again (user: js, size: 18220) [annotate] [blame] [check-ins using] [more...]
To Artifact [5b6a2f3354]:
- File
src/OFArray.m
— part of check-in
[627511b032]
at
2020-11-14 12:23:55
on branch trunk
— Rename of_malloc and of_calloc
The new names should be more accurate. (user: js, size: 18216) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
237 238 239 240 241 242 243 | for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } - (id const *)objects { size_t count = self.count; | | | 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 | for (size_t i = 0; i < range.length; i++) buffer[i] = [self objectAtIndex: range.location + i]; } - (id const *)objects { size_t count = self.count; id *buffer = of_alloc(count, sizeof(id)); @try { [self getObjects: buffer inRange: of_range(0, count)]; return [[OFData dataWithItemsNoCopy: buffer count: count |
︙ | ︙ | |||
379 380 381 382 383 384 385 | range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) return [OFSubarray arrayWithArray: self range: range]; | | | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 | range.location + range.length < self.count) @throw [OFOutOfRangeException exception]; if (![self isKindOfClass: [OFMutableArray class]]) return [OFSubarray arrayWithArray: self range: range]; buffer = of_alloc(range.length, sizeof(*buffer)); @try { [self getObjects: buffer inRange: range]; ret = [OFArray arrayWithObjects: buffer count: range.length]; } @finally { |
︙ | ︙ | |||
854 855 856 857 858 859 860 | } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block { OFArray *ret; size_t count = self.count; | | | | 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 | } #ifdef OF_HAVE_BLOCKS - (OFArray *)mappedArrayUsingBlock: (of_array_map_block_t)block { OFArray *ret; size_t count = self.count; id *tmp = of_alloc(count, sizeof(id)); @try { [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { tmp[idx] = block(object, idx); }]; ret = [OFArray arrayWithObjects: tmp count: count]; } @finally { free(tmp); } return ret; } - (OFArray *)filteredArrayUsingBlock: (of_array_filter_block_t)block { OFArray *ret; size_t count = self.count; id *tmp = of_alloc(count, sizeof(id)); @try { __block size_t i = 0; [self enumerateObjectsUsingBlock: ^ (id object, size_t idx, bool *stop) { if (block(object, idx)) |
︙ | ︙ |