ObjFW  Check-in [1c798ffa3f]

Overview
Comment:Get rid of a @try block in OFString.

This works since we release all pools on top of the pool being released
as well now.

Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 1c798ffa3fb6da58ed3eccdeefbe121cd1e10bfe9656618182ea40a870550510
User & Date: js on 2009-05-13 19:39:35
Other Links: manifest | tags
Context
2009-05-13
19:49
There's no need for + initialize to return anything. check-in: 917188fdcc user: js tags: trunk
19:39
Get rid of a @try block in OFString. check-in: 1c798ffa3f user: js tags: trunk
17:58
Also release pools that are on top of the pool being released. check-in: 4f4f619d84 user: js tags: trunk
Changes

Modified src/OFString.m from [e2d9167ac3] to [7666d17f06].

160
161
162
163
164
165
166
167
168

169
170
171
172
173
174
175
160
161
162
163
164
165
166


167
168
169
170
171
172
173
174







-
-
+







- (OFArray*)splitWithDelimiter: (const char*)delimiter
{
	OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
	OFArray *array = nil;
	size_t delim_len = strlen(delimiter);
	size_t i, last;

	@try {
		array = [[OFArray alloc] init];
	array = [OFArray array];

		for (i = 0, last = 0; i <= length; i++) {
			if (OF_UNLIKELY(i == length ||
			    !memcmp(string + i, delimiter, delim_len))) {
				OFString *str;
				char *tmp;

186
187
188
189
190
191
192

193
194
195
196
197
198
199

200
201

202
203
204
205

206
207

208
209
185
186
187
188
189
190
191
192
193
194
195
196
197
198

199


200


201

202


203
204
205







+






-
+
-
-
+
-
-

-
+
-
-
+


				@try {
					str = [OFString stringWithCString: tmp];
				} @finally {
					free(tmp);
				}

				[array add: str];
			[array retain];
				[pool releaseObjects];

				i += delim_len - 1;
				last = i + 1;
			}
		}
	} @catch (OFException *e) {

		if (array != nil)
			[array release];
	[array retain];
		@throw e;
	} @finally {
		[pool release];
	}


	return [array autorelease];
	return array;
}
@end