mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 00:30:53 +00:00
Rewrite last change to be a little more efficient
This commit is contained in:
parent
f3344628e5
commit
f1b3144209
1 changed files with 7 additions and 7 deletions
|
@ -1341,18 +1341,18 @@ GSICUStringMatchesRegex(NSString *string, NSString *regex, NSStringCompareOption
|
||||||
{
|
{
|
||||||
if ([_obj isKindOfClass: [NSArray class]])
|
if ([_obj isKindOfClass: [NSArray class]])
|
||||||
{
|
{
|
||||||
NSMutableArray *tmp = [(NSArray*)_obj mutableCopy];
|
NSUInteger count = [(NSArray*)_obj count];
|
||||||
NSUInteger count = [tmp count];
|
NSMutableArray *tmp = [NSMutableArray arrayWithCapacity: count];
|
||||||
NSUInteger index;
|
NSUInteger index = 0;
|
||||||
|
|
||||||
for (index = 0; index < count; index++)
|
while (index < count)
|
||||||
{
|
{
|
||||||
NSExpression *e = [tmp objectAtIndex: index];
|
NSExpression *e = [(NSArray*)_obj objectAtIndex: index++];
|
||||||
id o = [e expressionValueWithObject: e context: context];
|
id o = [e expressionValueWithObject: e context: context];
|
||||||
|
|
||||||
[tmp replaceObjectAtIndex: index withObject: o];
|
[tmp addObject: o];
|
||||||
}
|
}
|
||||||
return AUTORELEASE(tmp);
|
return tmp;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue