206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
|
-
+
+
+
-
+
+
+
|
objects[0] = firstObject;
for (size_t i = 1; i < count; i++) {
objects[i] = va_arg(arguments, id);
OFEnsure(objects[i] != nil);
}
return [self initWithObjects: objects count: count];
self = [self initWithObjects: objects count: count];
} @finally {
OFFreeMemory(objects);
}
return self;
}
- (instancetype)initWithArray: (OFArray *)array
{
id *objects;
size_t count;
@try {
count = array.count;
objects = OFAllocMemory(count, sizeof(id));
[array getObjects: objects
inRange: OFMakeRange(0, count)];
} @catch (id e) {
[self release];
@throw e;
}
@try {
return [self initWithObjects: objects count: count];
self = [self initWithObjects: objects count: count];
} @finally {
OFFreeMemory(objects);
}
return self;
}
#ifdef __clang__
/* We intentionally don't call into super, so silence the warning. */
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wunknown-pragmas"
# pragma clang diagnostic ignored "-Wobjc-designated-initializers"
|