ObjFW  Diff

Differences From Artifact [7d49a47280]:

  • File src/OFConstantString.m — part of check-in [3d16a30f41] at 2013-06-22 12:12:36 on branch trunk — Rework exceptions.

    This mostly removes the argument for the class in which the exception
    occurred. As backtraces were recently added for all platforms, the
    passed class does not give any extra information on where the exception
    occurred anymore.

    This also removes a few other arguments which were not too helpful. In
    the past, the idea was to pass as many arguments as possible so that it
    is easier to find the origin of the exception. However, as backtraces
    are a much better way to find the origin, those are not useful anymore
    and just make the exception more cumbersome to use. The rule is now to
    only pass arguments that might help in recovering from the exception or
    provide information that is otherwise not easily accessible. (user: js, size: 11937) [annotate] [blame] [check-ins using]

To Artifact [bf1e5cc793]:


23
24
25
26
27
28
29


30
31
32
33
34
35
36
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38







+
+








#import "OFConstantString.h"
#import "OFString_UTF8.h"

#import "OFInitializationFailedException.h"
#import "OFInvalidEncodingException.h"
#import "OFOutOfMemoryException.h"

#import "macros.h"

#if defined(OF_APPLE_RUNTIME) && !defined(__OBJC2__)
# import <objc/runtime.h>

struct {
	struct class *isa, *super_class;
	const char *name;
46
47
48
49
50
51
52
53

54
55
56
57
58
59
60

61
62
63
64
65
66
67

68
69
70
71
72
73
74

75
76
77
78
79
80
81
82

83
84
85
86
87
88

89
90
91
92
93
94
95
96
48
49
50
51
52
53
54

55

56
57
58
59
60

61

62
63
64
65
66

67

68
69
70
71
72

73

74
75
76
77
78
79

80

81
82
83
84

85

86
87
88
89
90
91
92







-
+
-





-
+
-





-
+
-





-
+
-






-
+
-




-
+
-








@interface OFString_const: OFString_UTF8
@end

@implementation OFString_const
+ alloc
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}


- (void*)allocMemoryWithSize: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
		count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void)freeMemory: (void*)pointer
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- retain
{
	return self;
}

106
107
108
109
110
111
112
113

114
115
116
117
118
119
120
121
102
103
104
105
106
107
108

109

110
111
112
113
114
115
116







-
+
-








- (void)release
{
}

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

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

@implementation OFConstantString
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
199
200

201
202
203
204
205
206
207
208

209
210
211
212
213
214

215
216
217
218
219
220
221
222
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

199

200
201
202
203

204

205
206
207
208
209
210
211







-
+
-




-
+
-





-
+
-





-
+
-






-
+
-




-
+
-







		_cString = (char*)ivars;
		object_setClass(self, [OFString_const class]);
	}
}

+ alloc
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)allocMemoryWithSize: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)allocMemoryWithSize: (size_t)size
		       count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void*)resizeMemory: (void*)pointer
		 size: (size_t)size
		count: (size_t)count
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- (void)freeMemory: (void*)pointer
{
	[self doesNotRecognizeSelector: _cmd];
	OF_UNRECOGNIZED_SELECTOR
	abort();
}

- retain
{
	return self;
}

232
233
234
235
236
237
238
239

240
241
242
243
244
245
246
247
221
222
223
224
225
226
227

228

229
230
231
232
233
234
235







-
+
-








- (void)release
{
}

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

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

/*
 * In all following methods, the constant string is converted to an