ObjFW  Check-in [bbb3994c06]

Overview
Comment:Nicer description for empty collections.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.5
Files: files | file ages | folders
SHA3-256: bbb3994c06c9bb0548b244baf8e5658ecef90b6d5ba0edfa0497ee1fe0e3f0a8
User & Date: js on 2011-04-28 18:15:52
Other Links: branch diff | manifest | tags
Context
2011-05-29
21:45
Properly check for thread-safe getaddrinfo if it's unknown. check-in: f6761575c6 user: js tags: 0.5
2011-04-28
18:15
Nicer description for empty collections. check-in: bbb3994c06 user: js tags: 0.5
18:03
Don't allow nil in -[initWithObjectForKey:] and optimize -[description]. check-in: 362d3ed5e8 user: js tags: 0.5
Changes

Modified src/OFArray.m from [21897744ee] to [47df73404c].

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 [7dc1c308f0] to [fc654f7782].

706
707
708
709
710
711
712
713
714
715
716




717
718
719








720
721
722
723
724
725
726
706
707
708
709
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







-
-
-
-
+
+
+
+



+
+
+
+
+
+
+
+







	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 [c7a2a0264c] to [169f8b1473].

282
283
284
285
286
287
288
289

290
291
292




293
294
295
296
297
298
299
282
283
284
285
286
287
288

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303







-
+



+
+
+
+







	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"];