ObjFW  Diff

Differences From Artifact [7db0d8023f]:

To Artifact [157ed5cd6f]:


49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
}

- (of_list_object_t*)last
{
	return last;
}

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

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = NULL;
	o->prev = last;







|







49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
}

- (of_list_object_t*)last
{
	return last;
}

- (of_list_object_t*)append: (OFObject*)obj
{
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = NULL;
	o->prev = last;
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	count++;

	[obj retain];

	return o;
}

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

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = first;
	o->prev = NULL;







|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
	count++;

	[obj retain];

	return o;
}

- (of_list_object_t*)prepend: (OFObject*)obj
{
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = first;
	o->prev = NULL;
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	count++;

	[obj retain];

	return o;
}

- (of_list_object_t*)insert: (id)obj
		     before: (of_list_object_t*)listobj
{
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = listobj;







|







95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
	count++;

	[obj retain];

	return o;
}

- (of_list_object_t*)insert: (OFObject*)obj
		     before: (of_list_object_t*)listobj
{
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = listobj;
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
	count++;

	[obj retain];

	return o;
}

- (of_list_object_t*)insert: (id)obj
		      after: (of_list_object_t*)listobj
{
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = listobj->next;







|







120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
	count++;

	[obj retain];

	return o;
}

- (of_list_object_t*)insert: (OFObject*)obj
		      after: (of_list_object_t*)listobj
{
	of_list_object_t *o;

	o = [self allocMemoryWithSize: sizeof(of_list_object_t)];
	o->object = [obj retain];
	o->next = listobj->next;
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
}

- (size_t)count
{
	return count;
}

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







|






|


|
|







171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
}

- (size_t)count
{
	return count;
}

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

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

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

	for (iter = first, iter2 = [(OFList*)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;