ObjFW  Check-in [2b5d03d8ea]

Overview
Comment:Add -[OFList removeAllObjects].
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 2b5d03d8eaf260cb41fc8757827d4f17f2510666829ccc43c1eda2c7781655e0
User & Date: js on 2012-09-11 12:10:52
Other Links: manifest | tags
Context
2012-09-11
13:41
The ivar "object" of OFThread should be protected. check-in: 1dc2f0b15f user: js tags: trunk
12:10
Add -[OFList removeAllObjects]. check-in: 2b5d03d8ea user: js tags: trunk
2012-09-09
17:50
Make thread ivars private. check-in: 3b1c4cc681 user: js tags: trunk
Changes

Modified src/OFList.h from [1e7516e1b8] to [2db9ff8a81].

149
150
151
152
153
154
155





156
157
158
159
160
161
162
163
164
165
166
167
168
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \return The last object of the list or nil
 */
- (id)lastObject;





@end

@interface OFListEnumerator: OFEnumerator
{
	OFList		 *list;
	of_list_object_t *current;
	unsigned long	 mutations;
	unsigned long	 *mutationsPtr;
}

-     initWithList: (OFList*)list
  mutationsPointer: (unsigned long*)mutationsPtr;
@end







>
>
>
>
>













149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
 *
 * The returned object is <i>not</i> retained and autoreleased for performance
 * reasons!
 *
 * \return The last object of the list or nil
 */
- (id)lastObject;

/**
 * \brief Removes all objects from the list.
 */
- (void)removeAllObjects;
@end

@interface OFListEnumerator: OFEnumerator
{
	OFList		 *list;
	of_list_object_t *current;
	unsigned long	 mutations;
	unsigned long	 *mutationsPtr;
}

-     initWithList: (OFList*)list
  mutationsPointer: (unsigned long*)mutationsPtr;
@end

Modified src/OFList.m from [c65623ed0a] to [9579281a19].

264
265
266
267
268
269
270
















271
272
273
274
275
276
277

	for (iter = firstListObject; iter != NULL; iter = iter->next)
		if (iter->object == object)
			return YES;

	return NO;
}

















- copy
{
	OFList *copy = [[[self class] alloc] init];
	of_list_object_t *iter, *listObject, *previous;

	listObject = NULL;







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293

	for (iter = firstListObject; iter != NULL; iter = iter->next)
		if (iter->object == object)
			return YES;

	return NO;
}

- (void)removeAllObjects
{
	of_list_object_t *iter, *next;

	mutations++;

	for (iter = firstListObject; iter != NULL; iter = next) {
		next = iter->next;

		[iter->object release];
		[self freeMemory: iter];
	}

	firstListObject = lastListObject = NULL;
}

- copy
{
	OFList *copy = [[[self class] alloc] init];
	of_list_object_t *iter, *listObject, *previous;

	listObject = NULL;

Modified src/OFNumber.m from [e4b0bb2ae2] to [5743167b4f].

940
941
942
943
944
945
946
947

948
949
950
951
952
953
954

- (of_comparison_result_t)compare: (id)object
{
	OFNumber *number;

	if (![object isKindOfClass: [OFNumber class]])
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]];


	number = object;

	if (type & OF_NUMBER_FLOAT || number->type & OF_NUMBER_FLOAT) {
		double double1 = [self doubleValue];
		double double2 = [number doubleValue];








|
>







940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955

- (of_comparison_result_t)compare: (id)object
{
	OFNumber *number;

	if (![object isKindOfClass: [OFNumber class]])
		@throw [OFInvalidArgumentException
		    exceptionWithClass: [self class]
			      selector: _cmd];

	number = object;

	if (type & OF_NUMBER_FLOAT || number->type & OF_NUMBER_FLOAT) {
		double double1 = [self doubleValue];
		double double2 = [number doubleValue];

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

9
10
11
12
13
14
15


16
17
18
19
20
21
22
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */



#import "OFSortedList.h"

#import "OFNotImplementedException.h"

@implementation OFSortedList
- (of_list_object_t*)appendObject: (id)object







>
>







9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
 * the packaging of this file.
 *
 * Alternatively, it may be distributed under the terms of the GNU General
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#import "OFSortedList.h"

#import "OFNotImplementedException.h"

@implementation OFSortedList
- (of_list_object_t*)appendObject: (id)object