ObjFW  Check-in [c32750da12]

Overview
Comment:Improve -[OFDictionary isEqual:].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | 0.6
Files: files | file ages | folders
SHA3-256: c32750da123fdd2c3df109b3cf8cadac64c8e5dceaf198127eec1e2db7ae5d56
User & Date: js on 2012-03-13 20:19:52
Other Links: branch diff | manifest | tags
Context
2012-03-16
17:14
Fix memory wasting in OFBigDataArray. check-in: d31c0b6fc8 user: js tags: 0.6
2012-03-13
20:19
Improve -[OFDictionary isEqual:]. check-in: c32750da12 user: js tags: 0.6
2012-03-07
22:22
Fix a missing (auto)release. check-in: a5933a2224 user: js tags: 0.6
Changes

Modified src/OFDictionary.m from [940c27c632] to [b3eb8803f5].

243
244
245
246
247
248
249
250

251

252
253
254
255





256

257
258
259
260
261
262
263

264
265
266
267
268
269
270
243
244
245
246
247
248
249

250
251
252
253
254
255
256
257
258
259
260
261

262
263
264
265
266
267
268

269
270
271
272
273
274
275
276







-
+

+




+
+
+
+
+
-
+






-
+







}

- mutableCopy
{
	return [[OFMutableDictionary alloc] initWithDictionary: self];
}

- (BOOL)isEqual: (id)dictionary
- (BOOL)isEqual: (id)object
{
	OFDictionary *otherDictionary;
	OFAutoreleasePool *pool;
	OFEnumerator *enumerator;
	id key;

	if (![object isKindOfClass: [OFDictionary class]])
		return NO;

	otherDictionary = object;

	if ([dictionary count] != [self count])
	if ([otherDictionary count] != [self count])
		return NO;

	pool = [[OFAutoreleasePool alloc] init];

	enumerator = [self keyEnumerator];
	while ((key = [enumerator nextObject]) != nil) {
		id object = [dictionary objectForKey: key];
		id object = [otherDictionary objectForKey: key];

		if (object == nil ||
		    ![object isEqual: [self objectForKey: key]]) {
			[pool release];
			return NO;
		}
	}