ObjFW  Check-in [d01d9805b3]

Overview
Comment:Nicer description for empty collections.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d01d9805b32b0382a3b3db4cde206ef08c4e6c317006d4d5f35898c19a32e84e
User & Date: js on 2011-04-28 18:15:52
Other Links: manifest | tags
Context
2011-04-28
18:44
Optimize sending of headers in OFHTTPRequest. check-in: 9575887d67 user: js tags: trunk
18:15
Nicer description for empty collections. check-in: d01d9805b3 user: js tags: trunk
18:03
Don't allow nil in -[initWithObjectForKey:] and optimize -[description]. check-in: a5f297053a user: js tags: trunk
Changes

Modified src/OFArray.m from [52d24426fd] to [a29168e02a].

394
395
396
397
398
399
400
401

402
403




404
405
406
407
408
409
410
394
395
396
397
398
399
400

401
402
403
404
405
406
407
408
409
410
411
412
413
414







-
+


+
+
+
+







	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFAutoreleasePool *pool;
	OFMutableString *ret;

	if ([array count] == 0)
		return @"()";

	pool = [[OFAutoreleasePool alloc] init];
	ret = [[self componentsJoinedByString: @",\n"] mutableCopy];

	@try {
		[ret prependString: @"(\n"];
		[ret replaceOccurrencesOfString: @"\n"
				     withString: @"\n\t"];
		[ret appendString: @"\n)"];

Modified src/OFDictionary.m from [f052320abe] to [8c80e7b8f4].

710
711
712
713
714
715
716
717
718
719
720




721
722
723








724
725
726
727
728
729
730
710
711
712
713
714
715
716




717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738







-
-
-
-
+
+
+
+



+
+
+
+
+
+
+
+







	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{
	OFMutableString *ret = [OFMutableString stringWithString: @"{\n"];
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init], *pool2;
	OFEnumerator *keyEnumerator = [self keyEnumerator];
	OFEnumerator *objectEnumerator = [self objectEnumerator];
	OFMutableString *ret;
	OFAutoreleasePool *pool, *pool2;
	OFEnumerator *keyEnumerator;
	OFEnumerator *objectEnumerator;
	id key, object;
	size_t i;

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

	ret = [OFMutableString stringWithString: @"{\n"];
	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 description]];
		[ret appendString: @" = "];

Modified src/OFList.m from [7c3c7d8b0c] to [b2fe60dc9c].

286
287
288
289
290
291
292
293

294
295
296




297
298
299
300
301
302
303
286
287
288
289
290
291
292

293
294
295
296
297
298
299
300
301
302
303
304
305
306
307







-
+



+
+
+
+







	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{
	OFMutableString *ret = [OFMutableString stringWithString: @"[\n"];
	OFMutableString *ret;
	OFAutoreleasePool *pool;
	of_list_object_t *iter;

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

	ret = [OFMutableString stringWithString: @"[\n"];
	pool = [[OFAutoreleasePool alloc] init];

	for (iter = firstListObject; iter != NULL; iter = iter->next) {
		[ret appendString: [iter->object description]];

		if (iter->next != NULL)
			[ret appendString: @",\n"];