mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-11 00:30:49 +00:00
Minor substring optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@22975 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
56e23e060e
commit
0dfcfd4814
2 changed files with 18 additions and 0 deletions
|
@ -4,6 +4,8 @@
|
|||
it needed more data even though it had actually completed.
|
||||
* Source/NSException.m: Don't add stacktrace information if we are
|
||||
not building with debug on.
|
||||
* Source/GSString.m: Minor optimisation ... return @"" for all
|
||||
substrings with a zero length range.
|
||||
|
||||
2006-05-22 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
|
|
|
@ -2455,6 +2455,10 @@ substring_c(GSStr self, NSRange aRange)
|
|||
@defs(GSCSubString)
|
||||
} *o;
|
||||
|
||||
if (aRange.length == 0)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
o = (typeof(o))NSAllocateObject(GSCSubStringClass,
|
||||
0, NSDefaultMallocZone());
|
||||
o->_contents.c = self->_contents.c + aRange.location;
|
||||
|
@ -2473,6 +2477,10 @@ substring_u(GSStr self, NSRange aRange)
|
|||
@defs(GSUnicodeSubString)
|
||||
} *o;
|
||||
|
||||
if (aRange.length == 0)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
o = (typeof(o))NSAllocateObject(GSUnicodeSubStringClass,
|
||||
0, NSDefaultMallocZone());
|
||||
o->_contents.u = self->_contents.u + aRange.location;
|
||||
|
@ -4127,6 +4135,10 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
{
|
||||
GS_RANGE_CHECK(aRange, _count);
|
||||
|
||||
if (aRange.length == 0)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
struct {
|
||||
|
@ -4164,6 +4176,10 @@ agree, create a new GSUnicodeInlineString otherwise.
|
|||
{
|
||||
GS_RANGE_CHECK(aRange, _count);
|
||||
|
||||
if (aRange.length == 0)
|
||||
{
|
||||
return @"";
|
||||
}
|
||||
if (_flags.wide == 1)
|
||||
{
|
||||
struct {
|
||||
|
|
Loading…
Reference in a new issue