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>
This commit is contained in:
Thiago Macieira 2019-01-30 20:16:42 -08:00
parent 9b8493314d
commit a5da01c044

View File

@ -544,11 +544,9 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
#if !QT_CONFIG(icu) #if !QT_CONFIG(icu)
QTextCodecCache *cache = &globalData->codecCache; QTextCodecCache *cache = &globalData->codecCache;
QTextCodec *codec; QTextCodec *codec;
if (cache) { codec = cache->value(name);
codec = cache->value(name); if (codec)
if (codec) return codec;
return codec;
}
for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) { for (TextCodecListConstIt it = globalData->allCodecs.constBegin(), cend = globalData->allCodecs.constEnd(); it != cend; ++it) {
QTextCodec *cursor = *it; QTextCodec *cursor = *it;
@ -560,8 +558,7 @@ QTextCodec *QTextCodec::codecForName(const QByteArray &name)
QList<QByteArray> aliases = cursor->aliases(); QList<QByteArray> aliases = cursor->aliases();
for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) { for (ByteArrayListConstIt ait = aliases.constBegin(), acend = aliases.constEnd(); ait != acend; ++ait) {
if (qTextCodecNameMatch(*ait, name)) { if (qTextCodecNameMatch(*ait, name)) {
if (cache) cache->insert(name, cursor);
cache->insert(name, cursor);
return cursor; return cursor;
} }
} }