ObjFW  Diff

Differences From Artifact [c06f8c5d7d]:

To Artifact [a7621f2b8f]:


8
9
10
11
12
13
14

15
16
17
18
19
20
21
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "config.h"

#import "OFList.h"


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








>







8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
 * Q Public License 1.0, which can be found in the file LICENSE included in
 * the packaging of this file.
 */

#import "config.h"

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

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

193
194
195
196
197
198
199







































200

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

	return YES;
}







































@end







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

194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
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
237
238
239
240

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

	return YES;
}

- (id)copy
{
	OFList *new;
	of_list_object_t *iter, *o, *prev;

	if (retain_and_release)
		new = [[OFList alloc] init];
	else
		new = [[OFList alloc] initWithoutRetainAndRelease];

	o = NULL;
	prev = NULL;

	@try {
		for (iter = first; iter != NULL; iter = iter->next) {
			o = [new allocWithSize: sizeof(of_list_object_t)];
			o->object = iter->object;
			o->next = NULL;
			o->prev = prev;

			if (new->first == NULL)
				new->first = o;
			if (prev != NULL)
				prev->next = o;
			if (retain_and_release)
				[o->object retain];

			prev = o;
		}
	} @catch (OFException *e) {
		[new release];
		@throw e;
	}

	new->last = o;

	return new;
}
@end