From 13da86a85b5366284166ec5b0f1ae84de30de182 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 25 Jul 2013 00:29:24 +0200 Subject: Remove unnecessary variable from the GMarkup-based unit parser (bzr r12439) --- src/util/units.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/util/units.cpp') diff --git a/src/util/units.cpp b/src/util/units.cpp index 757d05ffe..f8ebc5c1a 100644 --- a/src/util/units.cpp +++ b/src/util/units.cpp @@ -62,8 +62,6 @@ protected: virtual void on_end_element(Ctx &ctx, Glib::ustring const &name); virtual void on_text(Ctx &ctx, Glib::ustring const &text); - Glib::ustring _current_element; - public: UnitTable *tbl; bool primary; @@ -212,7 +210,6 @@ bool UnitTable::save(std::string const &filename) { void UnitParser::on_start_element(Ctx &ctx, Glib::ustring const &name, AttrMap const &attrs) { - _current_element = name; if (name == "unit") { // reset for next use unit.clear(); @@ -237,16 +234,17 @@ void UnitParser::on_start_element(Ctx &ctx, Glib::ustring const &name, AttrMap c void UnitParser::on_text(Ctx &ctx, Glib::ustring const &text) { - if (_current_element == "name") { + Glib::ustring element = ctx.get_element(); + if (element == "name") { unit.name = text; - } else if (_current_element == "plural") { + } else if (element == "plural") { unit.name_plural = text; - } else if (_current_element == "abbr") { + } else if (element == "abbr") { unit.abbr = text; - } else if (_current_element == "factor") { + } else if (element == "factor") { // TODO make sure we use the right conversion unit.factor = g_ascii_strtod(text.c_str(), NULL); - } else if (_current_element == "description") { + } else if (element == "description") { unit.description = text; } } -- cgit v1.2.3