ObjFW  Diff

Differences From Artifact [7a6a7331fd]:

To Artifact [6e205df884]:


12
13
14
15
16
17
18

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"


#include <string.h>

#include <assert.h>

#import "OFMutableArray.h"
#import "OFMutableArray_adjacent.h"

#import "OFEnumerationMutationException.h"
#import "OFInvalidArgumentException.h"
#import "OFNotImplementedException.h"
#import "OFOutOfRangeException.h"

#import "autorelease.h"
#import "macros.h"

static struct {
	Class isa;







>









<







12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28

29
30
31
32
33
34
35
 * Public License, either version 2 or 3, which can be found in the file
 * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
 * file.
 */

#include "config.h"

#include <stdlib.h>
#include <string.h>

#include <assert.h>

#import "OFMutableArray.h"
#import "OFMutableArray_adjacent.h"

#import "OFEnumerationMutationException.h"
#import "OFInvalidArgumentException.h"

#import "OFOutOfRangeException.h"

#import "autorelease.h"
#import "macros.h"

static struct {
	Class isa;
142
143
144
145
146
147
148
149

150
151

152
153
154
155
156
157
158

- (void)release
{
}

- (void)dealloc
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]

						    selector: _cmd];
	[super dealloc];	/* Get rid of a stupid warning */

}
@end

@implementation OFMutableArray
+ (void)initialize
{
	if (self == [OFMutableArray class])







|
>
|
|
>







142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160

- (void)release
{
}

- (void)dealloc
{
	[self doesNotRecognizeSelector: _cmd];
	abort();

	/* Get rid of a stupid warning */
	[super dealloc];
}
@end

@implementation OFMutableArray
+ (void)initialize
{
	if (self == [OFMutableArray class])
166
167
168
169
170
171
172

173


174
175
176

177
178
179
180
181
182
183

	return [super alloc];
}

- init
{
	if (object_getClass(self) == [OFMutableArray class]) {

		Class c = [self class];


		[self release];
		@throw [OFNotImplementedException exceptionWithClass: c
							    selector: _cmd];

	}

	return [super init];
}

- copy
{







>
|
>
>
|
|
<
>







168
169
170
171
172
173
174
175
176
177
178
179
180

181
182
183
184
185
186
187
188

	return [super alloc];
}

- init
{
	if (object_getClass(self) == [OFMutableArray class]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
			abort();
		} @catch (id e) {
			[self release];
			@throw e;

		}
	}

	return [super init];
}

- copy
{
195
196
197
198
199
200
201
202
203

204
205
206
207
208
209
210
	[self insertObjectsFromArray: array
			     atIndex: [self count]];
}

- (void)insertObject: (id)object
	     atIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];

}

- (void)insertObjectsFromArray: (OFArray*)array
		       atIndex: (size_t)index
{
	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *enumerator = [array objectEnumerator];







<
|
>







200
201
202
203
204
205
206

207
208
209
210
211
212
213
214
215
	[self insertObjectsFromArray: array
			     atIndex: [self count]];
}

- (void)insertObject: (id)object
	     atIndex: (size_t)index
{

	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)insertObjectsFromArray: (OFArray*)array
		       atIndex: (size_t)index
{
	void *pool = objc_autoreleasePoolPush();
	OFEnumerator *enumerator = [array objectEnumerator];
221
222
223
224
225
226
227
228
229

230
231
232
233
234
235
236

	objc_autoreleasePoolPop(pool);
}

- (void)replaceObjectAtIndex: (size_t)index
		  withObject: (id)object
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];

}

-    (void)setObject: (id)object
  atIndexedSubscript: (size_t)index
{
	[self replaceObjectAtIndex: index
			withObject: object];







<
|
>







226
227
228
229
230
231
232

233
234
235
236
237
238
239
240
241

	objc_autoreleasePoolPop(pool);
}

- (void)replaceObjectAtIndex: (size_t)index
		  withObject: (id)object
{

	[self doesNotRecognizeSelector: _cmd];
	abort();
}

-    (void)setObject: (id)object
  atIndexedSubscript: (size_t)index
{
	[self replaceObjectAtIndex: index
			withObject: object];
275
276
277
278
279
280
281
282
283

284
285
286
287
288
289
290
			return;
		}
	}
}

- (void)removeObjectAtIndex: (size_t)index
{
	@throw [OFNotImplementedException exceptionWithClass: [self class]
						    selector: _cmd];

}

- (void)removeObject: (id)object
{
	size_t i, count;

	if (object == nil)







<
|
>







280
281
282
283
284
285
286

287
288
289
290
291
292
293
294
295
			return;
		}
	}
}

- (void)removeObjectAtIndex: (size_t)index
{

	[self doesNotRecognizeSelector: _cmd];
	abort();
}

- (void)removeObject: (id)object
{
	size_t i, count;

	if (object == nil)