ObjFW  Diff

Differences From Artifact [a29168e02a]:

To Artifact [d8d0e45d9b]:


417
418
419
420
421
422
423













































424
425
426
427
428
429
430
		@throw e;
	}

	[pool release];

	[ret autorelease];














































	/*
	 * Class swizzle the string to be immutable. We declared the return type
	 * to be OFString*, so it can't be modified anyway. But not swizzling it
	 * would create a real copy each time -[copy] is called.
	 */
	ret->isa = [OFString class];
	return ret;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
		@throw e;
	}

	[pool release];

	[ret autorelease];

	/*
	 * Class swizzle the string to be immutable. We declared the return type
	 * to be OFString*, so it can't be modified anyway. But not swizzling it
	 * would create a real copy each time -[copy] is called.
	 */
	ret->isa = [OFString class];
	return ret;
}

- (OFString*)stringBySerializing
{
	OFAutoreleasePool *pool;
	OFMutableString *ret;
	OFObject <OFSerialization> **cArray;
	size_t i, count;
	IMP append;

	if ([array count] == 0) {
		if ([self isKindOfClass: [OFMutableArray class]])
			return @"<mutable,0>()";
		else
			return @"<0>()";
	}

	cArray = [array cArray];
	count = [array count];
	if ([self isKindOfClass: [OFMutableArray class]])
		ret = [OFMutableString stringWithFormat: @"<mutable,%zd>(",
							 count];
	else
		ret = [OFMutableString stringWithFormat: @"<%zd>(", count];
	pool = [[OFAutoreleasePool alloc] init];
	append = [ret methodForSelector: @selector(appendString:)];

	for (i = 0; i < count - 1; i++) {
		append(ret, @selector(appendString:),
		    [cArray[i] stringBySerializing]);
		append(ret, @selector(appendString:), @", ");

		[pool releaseObjects];
	}
	[ret appendFormat: @"%@)", [cArray[i] stringBySerializing]];

	[pool release];

	/*
	 * Class swizzle the string to be immutable. We declared the return type
	 * to be OFString*, so it can't be modified anyway. But not swizzling it
	 * would create a real copy each time -[copy] is called.
	 */
	ret->isa = [OFString class];
	return ret;