mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +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
|
@ -1,3 +1,12 @@
|
||||||
|
2013-01-08 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSString.m:
|
||||||
|
When creating a substring (A) of a substring (B) or a string (C),
|
||||||
|
we now retain the (C) in (A) rather than having (C) retain (B)
|
||||||
|
which in turn retains (A). This has the advantage that it is
|
||||||
|
possible for the intermediate (B) to be released if nothing else
|
||||||
|
ues it.
|
||||||
|
|
||||||
2013-01-05 00:49-EST Gregory John Casamento <greg.casamento@gmail.com>
|
2013-01-05 00:49-EST Gregory John Casamento <greg.casamento@gmail.com>
|
||||||
|
|
||||||
* Headers/Foundation/NSMetadata.h: Add _ to delegate.
|
* Headers/Foundation/NSMetadata.h: Add _ to delegate.
|
||||||
|
|
|
@ -3846,6 +3846,33 @@ agree, create a new GSCInlineString otherwise.
|
||||||
DESTROY(_parent);
|
DESTROY(_parent);
|
||||||
[super dealloc];
|
[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
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
@ -4220,6 +4247,21 @@ agree, create a new GSUInlineString otherwise.
|
||||||
DESTROY(_parent);
|
DESTROY(_parent);
|
||||||
[super dealloc];
|
[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
|
@end
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue