From c9d61ff71bf7e8a75d1a7afaa7b11fd409fa88fb Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Fri, 6 Mar 2015 21:15:50 -0500 Subject: [PATCH] Duration - Made list of units static. --- src/Duration.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Duration.cpp b/src/Duration.cpp index 28de33eb0..36b4a8bfd 100644 --- a/src/Duration.cpp +++ b/src/Duration.cpp @@ -284,10 +284,11 @@ bool Duration::parse (const std::string& input, std::string::size_type& start) std::string::size_type original_start = start; Nibbler n (input.substr (start)); - // TODO This can be made static, and so preserved between calls. - std::vector units; - for (int i = 0; i < NUM_DURATIONS; i++) - units.push_back (durations[i].unit); + // Static and so preserved between calls. + static std::vector units; + if (units.size () == 0) + for (int i = 0; i < NUM_DURATIONS; i++) + units.push_back (durations[i].unit); std::string number; std::string unit;