ObjFW  Diff

Differences From Artifact [a0d0c15800]:

To Artifact [005260144b]:


135
136
137
138
139
140
141

142
143
144




145
146
147
148
149
150
151
152
153
154
155
156
157
158

159
160
161




162
163
164
165
166
167
168
- removeNItems: (size_t)nitems
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];


	count -= nitems;

	data = [self resizeMemory: data
			 toNItems: count
			 withSize: itemsize];





	return self;
}

- removeNItems: (size_t)nitems
       atIndex: (size_t)index
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];

	memmove(data + index * itemsize, data + (index + nitems) * itemsize,
	    nitems * itemsize);

	count -= nitems;

	data = [self resizeMemory: data
			 toNItems: count
			 withSize: itemsize];





	return self;
}

- (id)copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemsize];







>
|
|
|
>
>
>
>














>
|
|
|
>
>
>
>







135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
- removeNItems: (size_t)nitems
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];


	count -= nitems;
	@try {
		data = [self resizeMemory: data
				 toNItems: count
				 withSize: itemsize];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
	}

	return self;
}

- removeNItems: (size_t)nitems
       atIndex: (size_t)index
{
	if (nitems > count)
		@throw [OFOutOfRangeException newWithClass: isa];

	memmove(data + index * itemsize, data + (index + nitems) * itemsize,
	    nitems * itemsize);

	count -= nitems;
	@try {
		data = [self resizeMemory: data
				 toNItems: count
				 withSize: itemsize];
	} @catch (OFOutOfMemoryException *e) {
		/* We don't really care, as we only made it smaller */
		[e dealloc];
	}

	return self;
}

- (id)copy
{
	OFDataArray *new = [[OFDataArray alloc] initWithItemSize: itemsize];