ObjFW  Diff

Differences From Artifact [c3388d8ecc]:

To Artifact [e2d9167ac3]:


153
154
155
156
157
158
159
160

161
162
163


164
165

166
167
168
169

170
171
172
173

174
175
176
177
178

179
180
181
182
183
184
185
153
154
155
156
157
158
159

160
161


162
163


164
165
166
167

168




169


170
171

172
173
174
175
176
177
178
179







-
+

-
-
+
+
-
-
+



-
+
-
-
-
-
+
-
-


-
+








- lower
{
	@throw [OFNotImplementedException newWithClass: isa
					   andSelector: _cmd];
}

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

	@try {
		pool = [[OFAutoreleasePool alloc] init];
		array = [[OFArray alloc] init];
	} @catch (OFException *e) {
		[array release];
		@throw e;
	}


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

				/*
				 * We can't use [self allocWithSize:] here as
				 * self might be a @""-literal.
				 */
199
200
201
202
203
204
205

206

207
208
209
210
211
212
213
214
193
194
195
196
197
198
199
200

201
202
203
204
205
206
207
208
209







+
-
+








				[pool releaseObjects];

				i += delim_len - 1;
				last = i + 1;
			}
		}
	} @catch (OFException *e) {
		if (array != nil)
		[array release];
			[array release];
		@throw e;
	} @finally {
		[pool release];
	}

	return [array autorelease];
}
@end