diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2019-01-30 20:16:42 -0800 |
---|---|---|
committer | Thiago Macieira <thiago.macieira@intel.com> | 2019-07-16 17:34:56 -0800 |
commit | a5da01c0449c4237280021a11271cd433707a523 (patch) | |
tree | 4cf8d64f4d2707d56d86c63e2fc56e5d24663a41 | |
parent | 9b8493314dd77f3e96b353187816bb7ef4dedbb5 (diff) |
Remove useless null pointer checks
Cache can't be null, since it's a member of an extant object.
Change-Id: Id98140e1c2f0426cabbefffd157ed3cdd62a8bba
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
-rw-r--r-- | src/corelib/codecs/qtextcodec.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/corelib/codecs/qtextcodec.cpp b/src/corelib/codecs/qtextcodec.cpp index 85cfcdbf48..8639e4f2f0 100644 --- a/src/corelib/codecs/qtextcodec.cpp +++ b/src/corelib/codecs/qtextcodec.cpp @@ -544,11 +544,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) #if !QT_CONFIG(icu) QTextCodecCache *cache = &globalData->codecCache; QTextCodec *codec; - if (cache) { - codec = cache->value(name); - if (codec) - return codec; - } + codec = cache->value(name); + if (codec) + return codec; for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) { QTextCodec *cursor = *it; @@ -560,8 +558,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name) QList<QByteArray> aliases = cursor->aliases(); for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) { if (qTextCodecNameMatch(*ait, name)) { - if (cache) - cache->insert(name, cursor); + cache->insert(name, cursor); return cursor; } } |