ObjFW  Check-in [06ad922132]

Overview
Comment:Work around a compiler bug that occurs on OS X.

It seems super has the wrong type (struct _objc_super*) inside a
@try block.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 06ad92213208422de1984add01dec1a2779fb9e60d978ee9e4353beba5e43b09
User & Date: js on 2009-05-01 22:28:50
Other Links: manifest | tags
Context
2009-05-02
15:33
Nicer way to create and initialize the socket in - accept. check-in: bdfd9d0464 user: js tags: trunk
2009-05-01
22:28
Work around a compiler bug that occurs on OS X. check-in: 06ad922132 user: js tags: trunk
20:24
Preliminary OFThread implementation. check-in: e5bcc6a3be user: js tags: trunk
Changes

Modified src/OFDictionary.m from [84c38f0c0c] to [e7cc2d1d1a].

37
38
39
40
41
42
43





44

45
46
47
48
49
50
51
37
38
39
40
41
42
43
44
45
46
47
48

49
50
51
52
53
54
55
56







+
+
+
+
+
-
+








	size = 4096;

	@try {
		data = [self allocNItems: size
				withSize: sizeof(OFList*)];
	} @catch (OFException *e) {
		/*
		 * We can't use [super free] on OS X here. Compiler bug?
		 * Anyway, set size to 0 so that [self free] works.
		 */
		size = 0;
		[super free];
		[self free];
		@throw e;
	}
	memset(data, 0, size);

	return self;
}

63
64
65
66
67
68
69





70

71
72
73
74
75
76
77
68
69
70
71
72
73
74
75
76
77
78
79

80
81
82
83
84
85
86
87







+
+
+
+
+
-
+








	size = (size_t)1 << hashsize;

	@try {
		data = [self allocNItems: size
				withSize: sizeof(OFList*)];
	} @catch (OFException *e) {
		/*
		 * We can't use [super free] on OS X here. Compiler bug?
		 * Anyway, set size to 0 so that [self free] works.
		 */
		size = 0;
		[super free];
		[self free];
		@throw e;
	}
	memset(data, 0, size);

	return self;
}

Modified src/OFString.m from [8c5b52d99d] to [3003617042].

164
165
166
167
168
169
170





171

172
173
174
175
176
177
178
164
165
166
167
168
169
170
171
172
173
174
175

176
177
178
179
180
181
182
183







+
+
+
+
+
-
+







				@throw [OFInvalidEncodingException
					newWithClass: c];
		}

		@try {
			string = [self allocWithSize: length + 1];
		} @catch (OFException *e) {
			/*
			 * We can't use [super free] on OS X here. Compiler bug?
			 * [self free] will do here as we don't reimplement
			 * free.
			 */
			[super free];
			[self free];
			@throw e;
		}
		memcpy(string, str, length + 1);
	}

	return self;
}