ObjFW  Diff

Differences From Artifact [ca60541ce0]:

To Artifact [169f8b1473]:


48
49
50
51
52
53
54
55

56
57
58
59
60

61
62
63
64
65
66
67
48
49
50
51
52
53
54

55
56
57
58
59

60
61
62
63
64
65
66
67







-
+




-
+








	for (iter = firstListObject; iter != NULL; iter = iter->next)
		[iter->object release];

	[super dealloc];
}

- (of_list_object_t*)firstListObject;
- (of_list_object_t*)firstListObject
{
	return firstListObject;
}

- (of_list_object_t*)lastListObject;
- (of_list_object_t*)lastListObject
{
	return lastListObject;
}

- (of_list_object_t*)appendObject: (id)obj
{
	of_list_object_t *o;
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
77
78
79
80
81
82
83


84
85
86
87
88
89
90







-
-







	lastListObject = o;
	if (firstListObject == NULL)
		firstListObject = o;

	count++;
	mutations++;

	[obj retain];

	return o;
}

- (of_list_object_t*)prependObject: (id)obj
{
	of_list_object_t *o;

101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
99
100
101
102
103
104
105


106
107
108
109
110
111
112







-
-







	firstListObject = o;
	if (lastListObject == NULL)
		lastListObject = o;

	count++;
	mutations++;

	[obj retain];

	return o;
}

- (of_list_object_t*)insertObject: (id)obj
		 beforeListObject: (of_list_object_t*)listobj
{
	of_list_object_t *o;
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
123
124
125
126
127
128
129


130
131
132
133
134
135
136







-
-








	if (listobj == firstListObject)
		firstListObject = o;

	count++;
	mutations++;

	[obj retain];

	return o;
}

- (of_list_object_t*)insertObject: (id)obj
		  afterListObject: (of_list_object_t*)listobj
{
	of_list_object_t *o;
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
147
148
149
150
151
152
153


154
155
156
157
158
159
160







-
-








	if (listobj == lastListObject)
		lastListObject = o;

	count++;
	mutations++;

	[obj retain];

	return o;
}

- (void)removeListObject: (of_list_object_t*)listobj
{
	if (listobj->prev != NULL)
		listobj->prev->next = listobj->next;
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
247
248
249
250
251
252
253


254
255
256
257
258
259
260







-
-







			if (new->firstListObject == NULL)
				new->firstListObject = o;
			if (prev != NULL)
				prev->next = o;

			new->count++;

			[o->object retain];

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

292
293
294
295
296
297
298
299

300
301
302




303
304
305
306
307
308
309
282
283
284
285
286
287
288

289
290
291
292
293
294
295
296
297
298
299
300
301
302
303







-
+



+
+
+
+







	OF_HASH_FINALIZE(hash);

	return hash;
}

- (OFString*)description
{
	OFMutableString *ret = [OFMutableString stringWithString: @"[\n"];
	OFMutableString *ret;
	OFAutoreleasePool *pool;
	of_list_object_t *iter;

	if (count == 0)
		return @"[]";

	ret = [OFMutableString stringWithString: @"[\n"];
	pool = [[OFAutoreleasePool alloc] init];

	for (iter = firstListObject; iter != NULL; iter = iter->next) {
		[ret appendString: [iter->object description]];

		if (iter->next != NULL)
			[ret appendString: @",\n"];
354
355
356
357
358
359
360
361

362
363
364
365
366
367
368
348
349
350
351
352
353
354

355
356
357
358
359
360
361
362







-
+







	        initWithList: self
	    mutationsPointer: &mutations] autorelease];
}
@end

@implementation OFListEnumerator
-     initWithList: (OFList*)list_
  mutationsPointer: (unsigned long*)mutationsPtr_;
  mutationsPointer: (unsigned long*)mutationsPtr_
{
	self = [super init];

	list = [list_ retain];
	current = [list firstListObject];
	mutations = *mutationsPtr_;
	mutationsPtr = mutationsPtr_;