ObjFW  Diff

Differences From Artifact [bebf07d610]:

To Artifact [4cf2dc29e8]:


15
16
17
18
19
20
21

22
23
24
25
26
27
28

#include "config.h"

#include <stdlib.h>

#import "OFSet.h"
#import "OFArray.h"

#import "OFMapTableSet.h"
#import "OFNull.h"
#import "OFString.h"

static struct {
	Class isa;
} placeholder;







>







15
16
17
18
19
20
21
22
23
24
25
26
27
28
29

#include "config.h"

#include <stdlib.h>

#import "OFSet.h"
#import "OFArray.h"
#import "OFCountedSet.h"
#import "OFMapTableSet.h"
#import "OFNull.h"
#import "OFString.h"

static struct {
	Class isa;
} placeholder;
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
}
@end

@implementation OFSet
+ (void)initialize
{
	if (self == [OFSet class])
		placeholder.isa = [OFSetPlaceholder class];
}

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








|







92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
}
@end

@implementation OFSet
+ (void)initialize
{
	if (self == [OFSet class])
		object_setClass((id)&placeholder, [OFSetPlaceholder class]);
}

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

138
139
140
141
142
143
144
145


146
147
148
149
150
151
152
{
	return [[[self alloc] initWithObjects: objects
					count: count] autorelease];
}

- (instancetype)init
{
	if ([self isMemberOfClass: [OFSet class]]) {


		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			[self release];
			@throw e;
		}








|
>
>







139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
{
	return [[[self alloc] initWithObjects: objects
					count: count] autorelease];
}

- (instancetype)init
{
	if ([self isMemberOfClass: [OFSet class]] ||
	    [self isMemberOfClass: [OFMutableSet class]] ||
	    [self isMemberOfClass: [OFCountedSet class]]) {
		@try {
			[self doesNotRecognizeSelector: _cmd];
		} @catch (id e) {
			[self release];
			@throw e;
		}