ObjFW  Check-in [7a8a5a2995]

Overview
Comment:-[OFSortedList addObject:] -> -[insertObject:].

The rationale behind this is that otherwise, there are two methods
called addObject: with a different signature, the one from
OFMutableArray and the one from OFSortedList. As OFSortedList is
actually using insertion sort and all other methods on an OFList start
with insert anyway, this is also more consistent.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7a8a5a299565ee22a90722d00a705de731369f41cea1067413090a7d61370d1c
User & Date: js on 2012-11-24 00:07:49
Other Links: manifest | tags
Context
2012-11-26
23:15
Better way to set the assembler + flags. check-in: af9448f6ed user: js tags: trunk
2012-11-24
00:07
-[OFSortedList addObject:] -> -[insertObject:]. check-in: 7a8a5a2995 user: js tags: trunk
2012-11-23
23:57
Allow passing nil to -[earlierDate/laterDate:]. check-in: 38dda0d1c7 user: js tags: trunk
Changes

Modified src/OFRunLoop.m from [5d7da15761] to [a5c17b66d7].

287
288
289
290
291
292
293
294
295
296
297
298
299
300
301

	[super dealloc];
}

- (void)addTimer: (OFTimer*)timer
{
	@synchronized (timersQueue) {
		[timersQueue addObject: timer];
	}
	[streamObserver cancel];
}

- (void)streamIsReadyForReading: (OFStream*)stream
{
	OFList *queue = [readQueues objectForKey: stream];







|







287
288
289
290
291
292
293
294
295
296
297
298
299
300
301

	[super dealloc];
}

- (void)addTimer: (OFTimer*)timer
{
	@synchronized (timersQueue) {
		[timersQueue insertObject: timer];
	}
	[streamObserver cancel];
}

- (void)streamIsReadyForReading: (OFStream*)stream
{
	OFList *queue = [readQueues objectForKey: stream];

Modified src/OFSortedList.h from [4d01ae293c] to [80e9c4dbfe].

20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * @brief A class which provides easy to use sorted double-linked lists.
 *
 * @warning Because the list is sorted, all methods inserting an object at a
 *	    specific place are unavailable, even though they exist in OFList!
 */
@interface OFSortedList: OFList
/*!
 * @brief Adds the object to the list while keeping the list sorted.
 *
 * @param object The object to add
 * @return The list object for the object just added
 */
- (of_list_object_t*)addObject: (id <OFComparing>)object;
@end







|

|


|

20
21
22
23
24
25
26
27
28
29
30
31
32
33
 * @brief A class which provides easy to use sorted double-linked lists.
 *
 * @warning Because the list is sorted, all methods inserting an object at a
 *	    specific place are unavailable, even though they exist in OFList!
 */
@interface OFSortedList: OFList
/*!
 * @brief Inserts the object to the list while keeping the list sorted.
 *
 * @param object The object to insert
 * @return The list object for the object just added
 */
- (of_list_object_t*)insertObject: (id <OFComparing>)object;
@end

Modified src/OFSortedList.m from [e06bf0474a] to [679b0761d3].

43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
- (of_list_object_t*)insertObject: (id)object
		  afterListObject: (of_list_object_t*)listObject
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (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







|












43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
- (of_list_object_t*)insertObject: (id)object
		  afterListObject: (of_list_object_t*)listObject
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];
}

- (of_list_object_t*)insertObject: (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