Author: rfm
Date: Sun May 24 16:12:42 2015
New Revision: 38530
URL: http://svn.gna.org/viewcvs/gnustep?rev=38530&view=rev
Log:
minor performance tweak
Modified:
libs/base/trunk/Source/GSString.m
Modified: libs/base/trunk/Source/GSString.m
URL:
http://svn.gna.org/viewcvs/gnustep/libs/base/trunk/Source/GSString.m?rev=38530&r1=38529&r2=38530&view=diff
==============================================================================
--- libs/base/trunk/Source/GSString.m (original)
+++ libs/base/trunk/Source/GSString.m Sun May 24 16:12:42 2015
@@ -2464,16 +2464,29 @@
static inline void
getCharacters_c(GSStr self, unichar *buffer, NSRange aRange)
{
- unsigned len = aRange.length;
-
- if (!len)
- return;
-
- if (!GSToUnicode(&buffer, &len, self->_contents.c + aRange.location,
- aRange.length, internalEncoding, 0, 0))
- {
- [NSException raise: NSInternalInconsistencyException
- format: @"Can't convert to Unicode."];
+ if (aRange.length)
+ {
+ if (NSISOLatin1StringEncoding == internalEncoding)
+ {
+ register NSUInteger count = aRange.length;
+ register NSUInteger base = aRange.location;
+
+ while (count-- > 0)
+ {
+ buffer[count] = self->_contents.c[base + count];
+ }
+ }
+ else
+ {
+ unsigned len = aRange.length;
+
+ if (!GSToUnicode(&buffer, &len, self->_contents.c + aRange.location,
+ aRange.length, internalEncoding, 0, 0))
+ {
+ [NSException raise: NSInternalInconsistencyException
+ format: @"Can't convert to Unicode."];
+ }
+ }
}
}
_______________________________________________
Gnustep-cvs mailing list
[email protected]
https://mail.gna.org/listinfo/gnustep-cvs