ObjFW  Diff

Differences From Artifact [d1d4c770ab]:

To Artifact [2a019fd7ef]:


19
20
21
22
23
24
25
26

27
28
29
30
31
32
33
34
35
36

37
38
39
40
41
42
43
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
35

36
37
38
39
40
41
42
43







-
+









-
+








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

#include <assert.h>

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

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

static struct {
	Class isa;
} placeholder;

@interface OFMutableArray_placeholder: OFMutableArray
@interface OFMutableArrayPlaceholder: OFMutableArray
@end

static of_comparison_result_t
compare(id left, id right, SEL selector)
{
	of_comparison_result_t (*comparator)(id, SEL, id) =
	    (of_comparison_result_t (*)(id, SEL, id))
134
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
179

180
181
182
183
184
185
186


187
188
189
190
191

192
193
194
195
196
197
198
134
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

179
180
181
182
183
184


185
186
187
188
189
190

191
192
193
194
195
196
197
198







-
+


-
+




-
+




-
+








-
-
+
+








-
-
+
+




-
+





-
-
+
+




-
+







			    options);

		left = i + 1;
	}
}
#endif

@implementation OFMutableArray_placeholder
@implementation OFMutableArrayPlaceholder
- (instancetype)init
{
	return (id)[[OFMutableArray_adjacent alloc] init];
	return (id)[[OFMutableAdjacentArray alloc] init];
}

- (instancetype)initWithCapacity: (size_t)capacity
{
	return (id)[[OFMutableArray_adjacent alloc] initWithCapacity: capacity];
	return (id)[[OFMutableAdjacentArray alloc] initWithCapacity: capacity];
}

- (instancetype)initWithObject: (id)object
{
	return (id)[[OFMutableArray_adjacent alloc] initWithObject: object];
	return (id)[[OFMutableAdjacentArray alloc] initWithObject: object];
}

- (instancetype)initWithObjects: (id)firstObject, ...
{
	id ret;
	va_list arguments;

	va_start(arguments, firstObject);
	ret = [[OFMutableArray_adjacent alloc] initWithObject: firstObject
						    arguments: arguments];
	ret = [[OFMutableAdjacentArray alloc] initWithObject: firstObject
						   arguments: arguments];
	va_end(arguments);

	return ret;
}

- (instancetype)initWithObject: (id)firstObject
		     arguments: (va_list)arguments
{
	return (id)[[OFMutableArray_adjacent alloc] initWithObject: firstObject
							 arguments: arguments];
	return (id)[[OFMutableAdjacentArray alloc] initWithObject: firstObject
							arguments: arguments];
}

- (instancetype)initWithArray: (OFArray *)array
{
	return (id)[[OFMutableArray_adjacent alloc] initWithArray: array];
	return (id)[[OFMutableAdjacentArray alloc] initWithArray: array];
}

- (instancetype)initWithObjects: (id const *)objects
			  count: (size_t)count
{
	return (id)[[OFMutableArray_adjacent alloc] initWithObjects: objects
							      count: count];
	return (id)[[OFMutableAdjacentArray alloc] initWithObjects: objects
							     count: count];
}

- (instancetype)initWithSerialization: (OFXMLElement *)element
{
	return (id)[[OFMutableArray_adjacent alloc]
	return (id)[[OFMutableAdjacentArray alloc]
	    initWithSerialization: element];
}

- (instancetype)retain
{
	return self;
}
212
213
214
215
216
217
218
219

220
221
222
223
224
225
226
212
213
214
215
216
217
218

219
220
221
222
223
224
225
226







-
+







}
@end

@implementation OFMutableArray
+ (void)initialize
{
	if (self == [OFMutableArray class])
		placeholder.isa = [OFMutableArray_placeholder class];
		placeholder.isa = [OFMutableArrayPlaceholder class];
}

+ (instancetype)alloc
{
	if (self == [OFMutableArray class])
		return (id)&placeholder;