mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
tiny optimisation to allow intermeidate substrings to be released earlier
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@35939 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4f4ab32e92
commit
6d9d73c0b4
2 changed files with 51 additions and 0 deletions
|
@ -3846,6 +3846,33 @@ agree, create a new GSCInlineString otherwise.
|
|||
DESTROY(_parent);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString*) substringFromRange: (NSRange)aRange
|
||||
{
|
||||
id s;
|
||||
|
||||
GS_RANGE_CHECK(aRange, _count);
|
||||
s = createTinyString((char*)_contents.c + aRange.location, aRange.length);
|
||||
if (nil == s)
|
||||
{
|
||||
s = substring_c((GSStr)_parent, aRange);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
- (NSString*) substringWithRange: (NSRange)aRange
|
||||
{
|
||||
id s;
|
||||
|
||||
GS_RANGE_CHECK(aRange, _count);
|
||||
s = createTinyString((char*)_contents.c + aRange.location, aRange.length);
|
||||
if (nil == s)
|
||||
{
|
||||
s = substring_c((GSStr)_parent, aRange);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -4220,6 +4247,21 @@ agree, create a new GSUInlineString otherwise.
|
|||
DESTROY(_parent);
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
- (NSString*) substringFromRange: (NSRange)aRange
|
||||
{
|
||||
GS_RANGE_CHECK(aRange, _count);
|
||||
aRange.location += (_contents.u - _parent->_contents.u);
|
||||
return substring_u((GSStr)_parent, aRange);
|
||||
}
|
||||
|
||||
- (NSString*) substringWithRange: (NSRange)aRange
|
||||
{
|
||||
GS_RANGE_CHECK(aRange, _count);
|
||||
aRange.location += (_contents.u - _parent->_contents.u);
|
||||
return substring_u((GSStr)_parent, aRange);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue