ObjFW  Diff

Differences From Artifact [489af893ca]:

To Artifact [e388818b36]:


47
48
49
50
51
52
53
















54
55
56
57
58
59
60
{
	[array insertItem: &object
		  atIndex: index];
	[object retain];

	mutations++;
}

















- (void)replaceObject: (id)oldObject
	   withObject: (id)newObject
{
	id *objects = [array cArray];
	size_t i, count = [array count];








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







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
{
	[array insertItem: &object
		  atIndex: index];
	[object retain];

	mutations++;
}

- (void)insertObjectsFromArray: (OFArray*)array_
		       atIndex: (size_t)index
{
	id *objects = [array_ objects];
	size_t i, count = [array_ count];

	[array insertItemsFromCArray: objects
			     atIndex: index
			       count: count];

	for (i = 0; i < count; i++)
		[objects[i] retain];

	mutations++;
}

- (void)replaceObject: (id)oldObject
	   withObject: (id)newObject
{
	id *objects = [array cArray];
	size_t i, count = [array count];

160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
{
	id *objects = [array cArray], *copy;
	size_t i, count = [array count];

	if (range.length > count - range.start)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	copy = [self allocMemoryWithItemSize: sizeof(*copy)
				       count: range.length];
	memcpy(copy, objects + range.start, range.length * sizeof(id));

	@try {
		[array removeItemsInRange: range];
		mutations++;

		for (i = 0; i < range.length; i++)







|
|







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
{
	id *objects = [array cArray], *copy;
	size_t i, count = [array count];

	if (range.length > count - range.start)
		@throw [OFOutOfRangeException exceptionWithClass: isa];

	copy = [self allocMemoryWithSize: sizeof(*copy)
				   count: range.length];
	memcpy(copy, objects + range.start, range.length * sizeof(id));

	@try {
		[array removeItemsInRange: range];
		mutations++;

		for (i = 0; i < range.length; i++)