ObjFW  Check-in [e4f8d0a4e9]

Overview
Comment:Remove now unnecessary safety check from -[componentsJoinedByString].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: e4f8d0a4e9b37e368ea231030b20f7f95b8b415307e091951f904eee2b051687
User & Date: js on 2010-11-17 20:35:44
Other Links: manifest | tags
Context
2010-11-17
22:31
Close file on exception in +[OFString stringWithContentsOfFile:]. check-in: cc34255955 user: js tags: trunk
20:35
Remove now unnecessary safety check from -[componentsJoinedByString]. check-in: e4f8d0a4e9 user: js tags: trunk
18:27
Adjust type to recent changes in -[OFArray componentsJoinedByString].
Not a problem, but changing it makes it clearer.
check-in: 5fe7a098d5 user: js tags: trunk
Changes

Modified src/OFArray.m from [3a4355d0c4] to [c5697552c0].

275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307

- (OFString*)componentsJoinedByString: (OFString*)separator
{
	OFAutoreleasePool *pool;
	OFString *str;
	OFObject **objs = [array cArray];
	size_t i, count = [array count];
	Class cls;
	IMP append;

	if (count == 0)
		return @"";
	if (count == 1)
		return [objs[0] description];

	str = [OFMutableString string];
	cls = [OFString class];
	append = [str methodForSelector: @selector(appendString:)];

	pool = [[OFAutoreleasePool alloc] init];

	for (i = 0; i < count - 1; i++) {
		if (![objs[i] isKindOfClass: cls])
			@throw [OFInvalidArgumentException newWithClass: isa
							       selector: _cmd];

		append(str, @selector(appendString:), [objs[i] description]);
		append(str, @selector(appendString:), separator);

		[pool releaseObjects];
	}
	append(str, @selector(appendString:), [objs[i] description]);








<








<





<
<
<
<







275
276
277
278
279
280
281

282
283
284
285
286
287
288
289

290
291
292
293
294




295
296
297
298
299
300
301

- (OFString*)componentsJoinedByString: (OFString*)separator
{
	OFAutoreleasePool *pool;
	OFString *str;
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	IMP append;

	if (count == 0)
		return @"";
	if (count == 1)
		return [objs[0] description];

	str = [OFMutableString string];

	append = [str methodForSelector: @selector(appendString:)];

	pool = [[OFAutoreleasePool alloc] init];

	for (i = 0; i < count - 1; i++) {




		append(str, @selector(appendString:), [objs[i] description]);
		append(str, @selector(appendString:), separator);

		[pool releaseObjects];
	}
	append(str, @selector(appendString:), [objs[i] description]);