25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"
static struct {
Class isa;
} placeholder;
@interface OFMutableArrayPlaceholder: OFMutableArray
@end
static void
quicksort(OFMutableArray *array, size_t left, size_t right,
OFCompareFunction compare, void *context, OFArraySortOptions options)
{
OFComparisonResult ascending, descending;
|
|
|
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
#import "OFInvalidArgumentException.h"
#import "OFOutOfRangeException.h"
static struct {
Class isa;
} placeholder;
@interface OFPlaceholderMutableArray: OFMutableArray
@end
static void
quicksort(OFMutableArray *array, size_t left, size_t right,
OFCompareFunction compare, void *context, OFArraySortOptions options)
{
OFComparisonResult ascending, descending;
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
quicksort(array, left, i - 1, compare, context,
options);
left = i + 1;
}
}
@implementation OFMutableArrayPlaceholder
- (instancetype)init
{
return (id)[[OFConcreteMutableArray alloc] init];
}
- (instancetype)initWithCapacity: (size_t)capacity
{
|
|
|
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
|
quicksort(array, left, i - 1, compare, context,
options);
left = i + 1;
}
}
@implementation OFPlaceholderMutableArray
- (instancetype)init
{
return (id)[[OFConcreteMutableArray alloc] init];
}
- (instancetype)initWithCapacity: (size_t)capacity
{
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
@end
@implementation OFMutableArray
+ (void)initialize
{
if (self == [OFMutableArray class])
object_setClass((id)&placeholder,
[OFMutableArrayPlaceholder class]);
}
+ (instancetype)alloc
{
if (self == [OFMutableArray class])
return (id)&placeholder;
|
|
|
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
|
@end
@implementation OFMutableArray
+ (void)initialize
{
if (self == [OFMutableArray class])
object_setClass((id)&placeholder,
[OFPlaceholderMutableArray class]);
}
+ (instancetype)alloc
{
if (self == [OFMutableArray class])
return (id)&placeholder;
|