aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/corelib/i18n/mlocale.cpp11
-rw-r--r--src/corelib/i18n/mlocale_p.h2
2 files changed, 4 insertions, 9 deletions
diff --git a/src/corelib/i18n/mlocale.cpp b/src/corelib/i18n/mlocale.cpp
index b024b759..5b245795 100644
--- a/src/corelib/i18n/mlocale.cpp
+++ b/src/corelib/i18n/mlocale.cpp
@@ -505,8 +505,8 @@ icu::DateFormat *MLocalePrivate::createDateFormat(MLocale::DateType dateType,
.arg(calendarType)
.arg(timeFormat24h)
.arg(categoryName(MLocale::MLcTime));
- if (_dateFormatCache && _dateFormatCache->contains(key))
- return _dateFormatCache->object(key);
+ if (_dateFormatCache.contains(key))
+ return _dateFormatCache.object(key);
// Create calLocale which has the time pattern we want to use
icu::Locale calLocale = MIcuConversions::createLocale(
categoryName(MLocale::MLcTime),
@@ -542,9 +542,7 @@ icu::DateFormat *MLocalePrivate::createDateFormat(MLocale::DateType dateType,
break;
}
}
- if (!_dateFormatCache)
- _dateFormatCache = new QCache<QString, icu::DateFormat>;
- _dateFormatCache->insert(key, df);
+ _dateFormatCache.insert(key, df);
return df;
}
#endif
@@ -560,7 +558,6 @@ MLocalePrivate::MLocalePrivate()
#ifdef HAVE_ICU
_numberFormat(0),
_numberFormatLcTime(0),
- _dateFormatCache(0),
#endif
#ifdef HAVE_GCONF
currentLanguageItem(SettingsLanguage),
@@ -598,7 +595,6 @@ MLocalePrivate::MLocalePrivate(const MLocalePrivate &other)
#ifdef HAVE_ICU
_numberFormat(0),
_numberFormatLcTime(0),
- _dateFormatCache(0),
#endif
_messageTranslations(other._messageTranslations),
_timeTranslations(other._timeTranslations),
@@ -669,7 +665,6 @@ MLocalePrivate &MLocalePrivate::operator=(const MLocalePrivate &other)
} else {
_numberFormatLcTime = 0;
}
- delete _dateFormatCache;
#endif
return *this;
diff --git a/src/corelib/i18n/mlocale_p.h b/src/corelib/i18n/mlocale_p.h
index 269d9554..e459ed17 100644
--- a/src/corelib/i18n/mlocale_p.h
+++ b/src/corelib/i18n/mlocale_p.h
@@ -183,7 +183,7 @@ public:
// number format caching for better performance.
icu::NumberFormat *_numberFormat;
icu::NumberFormat *_numberFormatLcTime;
- mutable QCache<QString, icu::DateFormat> *_dateFormatCache;
+ mutable QCache<QString, icu::DateFormat> _dateFormatCache;
#endif
// translations for two supported translation categories