diff options
author | Harald Fernengel <harald.fernengel@nokia.com> | 2011-12-20 13:42:17 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-20 16:18:27 +0100 |
commit | 2532ddc48b802fd8d4f5f15e128c932df85f007e (patch) | |
tree | 2f42785648ec99170ca6b120d7f875286406712f /src/corelib/tools/qstring.h | |
parent | b8ac9da63a833b0568f12bfe5c37da99c9570523 (diff) |
make QString::fromLatin1 partially inline
This allows us to benefit from compile time optimizations when calling
strlen()
Change-Id: If6694117e613a012fce97f8664e6b43005d255de
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/tools/qstring.h')
-rw-r--r-- | src/corelib/tools/qstring.h | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/tools/qstring.h b/src/corelib/tools/qstring.h index 4e1e67bfa6..cccf275ffd 100644 --- a/src/corelib/tools/qstring.h +++ b/src/corelib/tools/qstring.h @@ -408,7 +408,11 @@ public: QVector<uint> toUcs4() const Q_REQUIRED_RESULT; static QString fromAscii(const char *, int size = -1); - static QString fromLatin1(const char *, int size = -1); + static inline QString fromLatin1(const char *str, int size = -1) + { + // make this inline so we can benefit from strlen() compile time optimization + return QString(fromLatin1_helper(str, (str && size == -1) ? int(strlen(str)) : size), 0); + } static QString fromUtf8(const char *, int size = -1); static QString fromLocal8Bit(const char *, int size = -1); static QString fromUtf16(const ushort *, int size = -1); |