Differences From Artifact [5414c26349]:
- File
src/OFArray.m
— part of check-in
[2f4e0df8be]
at
2017-10-17 00:33:37
on branch trunk
— Do not use implicit method return types
Instead, explicitly declare them, as OF_ASSUME_NONNULL_{BEGIN,END} does
not apply to implicit return types. This means that after this commit,
all init methods have a nonnull return type, as they should have. (user: js, size: 18865) [annotate] [blame] [check-ins using]
To Artifact [1bed7cc771]:
- File src/OFArray.m — part of check-in [a06354b42a] at 2017-10-22 15:05:39 on branch trunk — Make Apple GCC with -Wshadow happy (user: js, size: 18845) [annotate] [blame] [check-ins using]
| ︙ | ︙ | |||
259 260 261 262 263 264 265 |
}
- (id)mutableCopy
{
return [[OFMutableArray alloc] initWithArray: self];
}
| | | | | 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
}
- (id)mutableCopy
{
return [[OFMutableArray alloc] initWithArray: self];
}
- (id)objectAtIndex: (size_t)idx
{
OF_UNRECOGNIZED_SELECTOR
}
- (id)objectAtIndexedSubscript: (size_t)idx
{
return [self objectAtIndex: idx];
}
- (id)valueForKey: (OFString *)key
{
id ret;
if ([key hasPrefix: @"@"]) {
|
| ︙ | ︙ | |||
872 873 874 875 876 877 878 |
{
OFArray *ret;
size_t count = [self count];
id *tmp = [self allocMemoryWithSize: sizeof(id)
count: count];
@try {
| | | | 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 |
{
OFArray *ret;
size_t count = [self count];
id *tmp = [self allocMemoryWithSize: sizeof(id)
count: count];
@try {
[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
bool *stop) {
tmp[idx] = block(object, idx);
}];
ret = [OFArray arrayWithObjects: tmp
count: count];
} @finally {
[self freeMemory: tmp];
}
|
| ︙ | ︙ | |||
896 897 898 899 900 901 902 |
size_t count = [self count];
id *tmp = [self allocMemoryWithSize: sizeof(id)
count: count];
@try {
__block size_t i = 0;
| | | | 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 |
size_t count = [self count];
id *tmp = [self allocMemoryWithSize: sizeof(id)
count: count];
@try {
__block size_t i = 0;
[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
bool *stop) {
if (block(object, idx))
tmp[i++] = object;
}];
ret = [OFArray arrayWithObjects: tmp
count: i];
} @finally {
[self freeMemory: tmp];
|
| ︙ | ︙ | |||
921 922 923 924 925 926 927 | __block id current; if (count == 0) return nil; if (count == 1) return [[[self firstObject] retain] autorelease]; | | | | 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 |
__block id current;
if (count == 0)
return nil;
if (count == 1)
return [[[self firstObject] retain] autorelease];
[self enumerateObjectsUsingBlock: ^ (id object, size_t idx,
bool *stop) {
id new;
if (idx == 0) {
current = [object retain];
return;
}
@try {
new = [block(current, object) retain];
} @finally {
|
| ︙ | ︙ |