ObjFW  Diff

Differences From Artifact [79d7aef834]:

To Artifact [7a1aa2d8ed]:


712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
	return hash;
}

- (OFString*)description
{
	OFMutableString *ret;
	OFAutoreleasePool *pool, *pool2;
	OFEnumerator *keyEnumerator;
	OFEnumerator *objectEnumerator;
	id key, object;
	size_t i;

	if (count == 0)
		return @"{}";

	ret = [OFMutableString stringWithString: @"{\n"];







|
<







712
713
714
715
716
717
718
719

720
721
722
723
724
725
726
	return hash;
}

- (OFString*)description
{
	OFMutableString *ret;
	OFAutoreleasePool *pool, *pool2;
	OFEnumerator *keyEnumerator, *objectEnumerator;

	id key, object;
	size_t i;

	if (count == 0)
		return @"{}";

	ret = [OFMutableString stringWithString: @"{\n"];
743
744
745
746
747
748
749



















































750
751
752
753
754
755
756

		[pool2 releaseObjects];
	}
	[ret replaceOccurrencesOfString: @"\n"
			     withString: @"\n\t"];
	[ret appendString: @";\n}"];




















































	[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.
	 */







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







742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806

		[pool2 releaseObjects];
	}
	[ret replaceOccurrencesOfString: @"\n"
			     withString: @"\n\t"];
	[ret appendString: @";\n}"];

	[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;
}

- (OFString*)stringBySerializing
{
	OFMutableString *ret;
	OFAutoreleasePool *pool, *pool2;
	OFEnumerator *keyEnumerator, *objectEnumerator;
	id key, object;
	size_t i;

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

	if ([self isKindOfClass: [OFMutableDictionary class]])
		ret = [OFMutableString stringWithFormat: @"<mutable,%zd>{",
							 count];
	else
		ret = [OFMutableString stringWithFormat: @"<%zd>{", count];
	pool = [[OFAutoreleasePool alloc] init];
	keyEnumerator = [self keyEnumerator];
	objectEnumerator = [self objectEnumerator];

	i = 0;
	pool2 = [[OFAutoreleasePool alloc] init];

	while ((key = [keyEnumerator nextObject]) != nil &&
	    (object = [objectEnumerator nextObject]) != nil) {
		[ret appendString: [key stringBySerializing]];
		[ret appendString: @" = "];
		[ret appendString: [object stringBySerializing]];

		if (++i < count)
			[ret appendString: @"; "];

		[pool2 releaseObjects];
	}
	[ret appendString: @"}"];

	[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.
	 */