From 3f57b929ee2a2a6a0f7c04e4c3a33625b20bde73 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Wed, 11 Dec 2019 01:43:53 +1000 Subject: [PATCH] [libcalamares] Make the zoneTab region list static - there's only one zone.tab, it won't change during a run, load it only once (this allows for a single global list). --- src/libcalamares/locale/TimeZone.cpp | 5 +++-- src/libcalamares/locale/TimeZone.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/libcalamares/locale/TimeZone.cpp b/src/libcalamares/locale/TimeZone.cpp index ea77fc39e..ad09d82d5 100644 --- a/src/libcalamares/locale/TimeZone.cpp +++ b/src/libcalamares/locale/TimeZone.cpp @@ -130,10 +130,11 @@ TZRegion::~TZRegion() qDeleteAll( m_zones ); } -CStringPairList +const CStringPairList& TZRegion::fromZoneTab() { - return TZRegion::fromFile( TZ_DATA_FILE ); + static CStringPairList zoneTab = TZRegion::fromFile( TZ_DATA_FILE ); + return zoneTab; } CStringPairList diff --git a/src/libcalamares/locale/TimeZone.h b/src/libcalamares/locale/TimeZone.h index 19d0011b2..dd1f9714d 100644 --- a/src/libcalamares/locale/TimeZone.h +++ b/src/libcalamares/locale/TimeZone.h @@ -103,7 +103,7 @@ public: */ static CStringPairList fromFile( const char* fileName ); /// @brief Calls fromFile with the standard zone.tab name - static CStringPairList fromZoneTab(); + static const CStringPairList& fromZoneTab(); const CStringPairList& zones() const { return m_zones; }