mirror of
https://github.com/gnustep/libs-base.git
synced 2025-06-01 09:02:01 +00:00
more utf8 optimisation
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38542 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
325689b04f
commit
8d31d3a100
1 changed files with 11 additions and 5 deletions
|
@ -1072,7 +1072,7 @@ tsbytes(uintptr_t s, char *buf)
|
||||||
/**
|
/**
|
||||||
* Constructs a tiny string.
|
* Constructs a tiny string.
|
||||||
*/
|
*/
|
||||||
static id
|
static inline id
|
||||||
createTinyString(const char *str, int length)
|
createTinyString(const char *str, int length)
|
||||||
{
|
{
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
|
@ -1112,7 +1112,7 @@ createTinyString(const char *str, int length)
|
||||||
return (id)s;
|
return (id)s;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static id
|
static inline id
|
||||||
createTinyString(const char *str, int length)
|
createTinyString(const char *str, int length)
|
||||||
{
|
{
|
||||||
return nil;
|
return nil;
|
||||||
|
@ -1712,9 +1712,15 @@ fixBOM(unsigned char **bytes, NSUInteger*length, BOOL *owned,
|
||||||
|
|
||||||
if (YES == ascii)
|
if (YES == ascii)
|
||||||
{
|
{
|
||||||
me = (GSStr)newCInline(length, myZone);
|
id o = createTinyString(bytes, length);
|
||||||
memcpy(me->_contents.c, bytes, length);
|
|
||||||
return (id)me;
|
if (nil == o)
|
||||||
|
{
|
||||||
|
me = (GSStr)newCInline(length, myZone);
|
||||||
|
memcpy(me->_contents.c, bytes, length);
|
||||||
|
o = (id)me;
|
||||||
|
}
|
||||||
|
return o;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue