ObjFW  Check-in [4357c856cc]

Overview
Comment:Make OFSortedList sort stable.

This means that if two or more equal objects are added, the order in
which the objects were added is kept.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4357c856cceab67a9a91a2956ef741d299201fc1e022185ba08b4554435eae6b
User & Date: js on 2012-09-12 06:00:30
Other Links: manifest | tags
Context
2012-09-12
06:11
OFRunLoop: Remove timer before possible read. check-in: 55e7d380e4 user: js tags: trunk
06:00
Make OFSortedList sort stable. check-in: 4357c856cc user: js tags: trunk
06:00
OFStreamObserver: Cancel is no event anymore. check-in: 3de549d6a5 user: js tags: trunk
Changes

Modified src/OFSortedList.m from [506ed04501] to [e06bf0474a].

48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
}

- (of_list_object_t*)addObject: (id <OFComparing>)object
{
	of_list_object_t *iter;

	for (iter = lastListObject; iter != NULL; iter = iter->previous) {
		if ([object compare: iter->object] == OF_ORDERED_DESCENDING)
			return [super insertObject: object
				   afterListObject: iter];
	}

	return [super prependObject: object];
}
@end







|







48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
}

- (of_list_object_t*)addObject: (id <OFComparing>)object
{
	of_list_object_t *iter;

	for (iter = lastListObject; iter != NULL; iter = iter->previous) {
		if ([object compare: iter->object] != OF_ORDERED_ASCENDING)
			return [super insertObject: object
				   afterListObject: iter];
	}

	return [super prependObject: object];
}
@end