From fb0d8859042570a15e0477f1ba6adf638b01db0f Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Mon, 19 Jun 2017 11:43:05 +0200 Subject: Move locale insensitive stdtod to vespalib --- config/src/vespa/config/common/configparser.cpp | 23 ++--------------------- 1 file changed, 2 insertions(+), 21 deletions(-) (limited to 'config/src') diff --git a/config/src/vespa/config/common/configparser.cpp b/config/src/vespa/config/common/configparser.cpp index 1f303c49871..6784f0793e9 100644 --- a/config/src/vespa/config/common/configparser.cpp +++ b/config/src/vespa/config/common/configparser.cpp @@ -4,7 +4,7 @@ #include "exceptions.h" #include "misc.h" #include -#include +#include namespace config { @@ -339,25 +339,6 @@ ConfigParser::convert(const vsvector & config) return ret; } -namespace { - -class Locale { -public: - Locale() : Locale(LC_ALL_MASK, "C") { } - Locale(int category, const char *locale) : _locale(newlocale(category, locale, nullptr)) - { - perror("newlocale failed"); - assert(_locale != nullptr); - } - ~Locale() { freelocale(_locale); } - locale_t get() const { return _locale; } -private: - locale_t _locale; -}; - -Locale _G_C_Locale; -} - template<> double ConfigParser::convert(const vsvector & config) @@ -371,7 +352,7 @@ ConfigParser::convert(const vsvector & config) const char *startp = value.c_str(); char *endp; errno = 0; - double ret = strtod_l(startp, &endp, _G_C_Locale.get()); + double ret = vespalib::locale::c::strtod(startp, &endp); int err = errno; if (err == ERANGE || (*endp != '\0')) { throw InvalidConfigException("Value " + value + " is not a legal double", VESPA_STRLOC); -- cgit v1.2.3