ObjFW  Diff

Differences From Artifact [d5e78125eb]:

To Artifact [ca890914b8]:


36
37
38
39
40
41
42


43
44
45
46
47
48
49
50
51


52
53
54
55
56
57
58
}

- addObject: (OFObject*)obj
{
	[array addItem: &obj];
	[obj retain];



	return self;
}

- addObject: (OFObject*)obj
    atIndex: (size_t)index
{
	[array addItem: &obj
	       atIndex: index];
	[obj retain];



	return self;
}

- replaceObject: (OFObject*)old
     withObject: (OFObject*)new
{







>
>









>
>







36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
}

- addObject: (OFObject*)obj
{
	[array addItem: &obj];
	[obj retain];

	mutations++;

	return self;
}

- addObject: (OFObject*)obj
    atIndex: (size_t)index
{
	[array addItem: &obj
	       atIndex: index];
	[obj retain];

	mutations++;

	return self;
}

- replaceObject: (OFObject*)old
     withObject: (OFObject*)new
{
106
107
108
109
110
111
112

113


114
115
116
117
118
119
120
121
122
123
124
125
126
127
128


129
130
131
132
133
134
135
{
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	for (i = 0; i < count; i++) {
		if ([objs[i] isEqual: obj]) {
			OFObject *obj = objs[i];

			[array removeItemAtIndex: i];


			[obj release];
		}
	}

	return self;
}

- removeObjectIdenticalTo: (OFObject*)obj
{
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	for (i = 0; i < count; i++) {
		if (objs[i] == obj) {
			[array removeItemAtIndex: i];


			[obj release];
		}
	}

	return self;
}








>

>
>















>
>







110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
{
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	for (i = 0; i < count; i++) {
		if ([objs[i] isEqual: obj]) {
			OFObject *obj = objs[i];

			[array removeItemAtIndex: i];
			mutations++;

			[obj release];
		}
	}

	return self;
}

- removeObjectIdenticalTo: (OFObject*)obj
{
	OFObject **objs = [array cArray];
	size_t i, count = [array count];

	for (i = 0; i < count; i++) {
		if (objs[i] == obj) {
			[array removeItemAtIndex: i];
			mutations++;

			[obj release];
		}
	}

	return self;
}

149
150
151
152
153
154
155

156
157
158
159
160
161
162

	copy = [self allocMemoryForNItems: nobjects
				 withSize: sizeof(OFObject*)];
	memcpy(copy, objs + (count - nobjects), nobjects * sizeof(OFObject*));

	@try {
		[array removeNItems: nobjects];


		for (i = 0; i < nobjects; i++)
			[copy[i] release];
	} @finally {
		[self freeMemory: copy];
	}








>







158
159
160
161
162
163
164
165
166
167
168
169
170
171
172

	copy = [self allocMemoryForNItems: nobjects
				 withSize: sizeof(OFObject*)];
	memcpy(copy, objs + (count - nobjects), nobjects * sizeof(OFObject*));

	@try {
		[array removeNItems: nobjects];
		mutations++;

		for (i = 0; i < nobjects; i++)
			[copy[i] release];
	} @finally {
		[self freeMemory: copy];
	}

175
176
177
178
179
180
181

182
183
184
185
186
187
188
189
190
191
	copy = [self allocMemoryForNItems: nobjects
				 withSize: sizeof(OFObject*)];
	memcpy(copy, objs + index, nobjects * sizeof(OFObject*));

	@try {
		[array removeNItems: nobjects
			    atIndex: index];


		for (i = 0; i < nobjects; i++)
			[copy[i] release];
	} @finally {
		[self freeMemory: copy];
	}

	return self;
}
@end







>










185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
	copy = [self allocMemoryForNItems: nobjects
				 withSize: sizeof(OFObject*)];
	memcpy(copy, objs + index, nobjects * sizeof(OFObject*));

	@try {
		[array removeNItems: nobjects
			    atIndex: index];
		mutations++;

		for (i = 0; i < nobjects; i++)
			[copy[i] release];
	} @finally {
		[self freeMemory: copy];
	}

	return self;
}
@end