From a970dc423d59ea844bdb1af48d5d9419a5e2a287 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 13 Oct 2013 00:24:05 +0200 Subject: Units: stop newing Unit objects. pass around pointers to "undeletable" Unit objects in the UnitTable. I think we should move to using indexed units, and pass around the index of the unit in the unittable, or smth like that... ? (bzr r12679) --- src/preferences.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/preferences.cpp') diff --git a/src/preferences.cpp b/src/preferences.cpp index 0dc6f1ec4..0dcebbb90 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -785,9 +785,8 @@ double Preferences::_extractDouble(Entry const &v, Glib::ustring const &requeste if (unit.length() == 0) { // no unit specified, don't do conversion return val; - } else { - return val * (unit_table.getUnit(unit).factor / unit_table.getUnit(requested_unit).factor); } + return val * (unit_table.getUnit(unit)->factor / unit_table.getUnit(requested_unit)->factor); /// \todo rewrite using Quantity class, so the standard code handles unit conversion } Glib::ustring Preferences::_extractString(Entry const &v) -- cgit v1.2.3