ObjFW  Diff

Differences From Artifact [3dcb760b24]:

To Artifact [6526cc451e]:


1
2
3
4
5
6
7
8
9
10
11
12
13


14
15
16
17
18
19
20
/*
 * Copyright (c) 2008 - 2009
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#include "config.h"



#import "OFList.h"
#import "OFExceptions.h"

@implementation OFList
+ list
{
	return [[[self alloc] init] autorelease];













>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/*
 * Copyright (c) 2008 - 2009
 *   Jonathan Schleifer <js@webkeks.org>
 *
 * All rights reserved.
 *
 * This file is part of libobjfw. It may be distributed under the terms of the
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#include "config.h"

#include "assert.h"

#import "OFList.h"
#import "OFExceptions.h"

@implementation OFList
+ list
{
	return [[[self alloc] init] autorelease];
210
211
212
213
214
215
216



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232

- (BOOL)isEqual: (id)obj
{
	of_list_object_t *iter, *iter2;

	if (![obj isKindOfClass: [OFList class]])
		return NO;




	for (iter = first, iter2 = [obj first]; iter != NULL && iter2 != NULL;
	    iter = iter->next, iter2 = iter2->next)
		if (![iter->object isEqual: iter2->object])
			return NO;

	/* One has still items */
	if (iter != NULL || iter2 != NULL)
		return NO;

	return YES;
}

- (id)copy
{
	OFList *new;







>
>
>






|
|
<







212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236

- (BOOL)isEqual: (id)obj
{
	of_list_object_t *iter, *iter2;

	if (![obj isKindOfClass: [OFList class]])
		return NO;

	if ([obj count] != count)
		return NO;

	for (iter = first, iter2 = [obj first]; iter != NULL && iter2 != NULL;
	    iter = iter->next, iter2 = iter2->next)
		if (![iter->object isEqual: iter2->object])
			return NO;

	/* One is bigger than the other although we checked the count */
	assert(iter == NULL && iter2 == NULL);


	return YES;
}

- (id)copy
{
	OFList *new;