307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
|
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
|
-
+
+
-
-
|
OF_HASH_FINALIZE(hash);
return hash;
}
- (OFArray*)splitWithDelimiter: (OFString*)delimiter
{
OFAutoreleasePool *pool = [[OFAutoreleasePool alloc] init];
OFAutoreleasePool *pool;
OFArray *array = nil;
OFString *str;
const char *delim = [delimiter cString];
size_t delim_len = [delimiter length];
size_t i, last;
array = [OFMutableArray array];
pool = [[OFAutoreleasePool alloc] init];
if (delim_len > length) {
str = [[self copy] autorelease];
[array addObject: str];
[array retain];
[pool release];
return array;
}
for (i = 0, last = 0; i <= length - delim_len; i++) {
char *tmp;
|
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
|
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
|
-
-
|
@try {
str = [OFString stringWithCString: tmp];
} @finally {
free(tmp);
}
[array addObject: str];
[array retain];
[pool releaseObjects];
i += delim_len - 1;
last = i + 1;
}
[array addObject: [OFString stringWithCString: string + last]];
[array retain];
[pool release];
return array;
}
- setToCString: (const char*)str
{
|