mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 08:41:03 +00:00
Small optimisation for creating NSString from UTF8 C string
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@38539 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
50d5d7789b
commit
1c74bc231b
3 changed files with 70 additions and 3 deletions
|
@ -981,7 +981,14 @@ GSICUCollatorOpen(NSStringCompareOptions mask, NSLocale *locale)
|
|||
if (NULL == bytes)
|
||||
[NSException raise: NSInvalidArgumentException
|
||||
format: @"[NSString+stringWithUTF8String:]: NULL cString"];
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
if (self == NSStringClass)
|
||||
{
|
||||
obj = defaultPlaceholderString;
|
||||
}
|
||||
else
|
||||
{
|
||||
obj = [self allocWithZone: NSDefaultMallocZone()];
|
||||
}
|
||||
obj = [obj initWithUTF8String: bytes];
|
||||
return AUTORELEASE(obj);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue