From 9f0ae431490549ecf9201a821aa932fa19d00e54 Mon Sep 17 00:00:00 2001 From: Stephen Shelton Date: Thu, 19 Mar 2020 14:05:03 -0600 Subject: [PATCH] Remove dead code --- llarp/config/config.cpp | 20 -------------------- llarp/config/config.hpp | 18 ------------------ llarp/config/ini.cpp | 34 ---------------------------------- llarp/config/ini.hpp | 22 ---------------------- 4 files changed, 94 deletions(-) diff --git a/llarp/config/config.cpp b/llarp/config/config.cpp index bedacc5ba..2e102e914 100644 --- a/llarp/config/config.cpp +++ b/llarp/config/config.cpp @@ -73,26 +73,6 @@ namespace llarp return val; } - int - svtoi(string_view val) - { - return std::atoi(val.data()); - } - - nonstd::optional - setOptBool(string_view val) - { - if (IsTrueValue(val)) - { - return true; - } - else if (IsFalseValue(val)) - { - return false; - } - return {}; - } - void RouterConfig::defineConfigOptions(Configuration& conf) { diff --git a/llarp/config/config.hpp b/llarp/config/config.hpp index 348a2cf69..8ab8131f5 100644 --- a/llarp/config/config.hpp +++ b/llarp/config/config.hpp @@ -15,24 +15,6 @@ #include #include -/* - * section names - * XXX: remove me - * - router = find_section< RouterConfig >(parser, "router"); - network = find_section< NetworkConfig >(parser, "network"); - connect = find_section< ConnectConfig >(parser, "connect"); - netdb = find_section< NetdbConfig >(parser, "netdb"); - dns = find_section< DnsConfig >(parser, "dns"); - links = find_section< LinksConfig >(parser, "bind"); - services = find_section< ServicesConfig >(parser, "services"); - system = find_section< SystemConfig >(parser, "system"); - api = find_section< ApiConfig >(parser, "api"); - lokid = find_section< LokidConfig >(parser, "lokid"); - bootstrap = find_section< BootstrapConfig >(parser, "bootstrap"); - logging = find_section< LoggingConfig >(parser, "logging"); -*/ - namespace llarp { using SectionValues_t = llarp::ConfigParser::SectionValues_t; diff --git a/llarp/config/ini.cpp b/llarp/config/ini.cpp index 1ce0a54be..42abf02e3 100644 --- a/llarp/config/ini.cpp +++ b/llarp/config/ini.cpp @@ -152,40 +152,6 @@ namespace llarp visit(item.first, item.second); } - const std::string emptyStr = ""; - - const std::string& - ConfigParser::getSingleSectionValue( - const SectionValues_t& values, - const std::string& section, - const std::string& key, - bool required, - bool tolerateMultiples) const - { - // section is provided for clarity / sanity check - assert(m_Config.find(section) != m_Config.end()); - assert( & m_Config.find(section)->second == &values); - - const auto sectionItr = m_Config.find(section); - if (sectionItr == m_Config.end()) - throw std::invalid_argument(stringify("could not find section ", section)); - - const SectionValues_t& sectionValues = sectionItr->second; - - if (not tolerateMultiples and sectionValues.count(key) > 1) - throw std::invalid_argument(stringify("config [", section, "]:", key, " cannot have multiple values for ", key)); - - const auto itr = sectionValues.find(key); - if (itr == sectionValues.end()) { - if (required) - throw std::invalid_argument(stringify("config [", section, "]:", key, " is missing")); - else - return emptyStr; - } - - return itr->second; - } - bool ConfigParser::VisitSection( const char* name, diff --git a/llarp/config/ini.hpp b/llarp/config/ini.hpp index d392df506..836bd4c01 100644 --- a/llarp/config/ini.hpp +++ b/llarp/config/ini.hpp @@ -40,28 +40,6 @@ namespace llarp VisitSection(const char* name, std::function< bool(const SectionValues_t&) > visit) const; - /// Obtain a section value for the given key, additionally imposing the - /// provided constraints. an `invalid_argument` will be thrown if the - /// constraints aren't met. - /// - /// The `section` parameter is redundant and added for readability, but a call to - /// m_Config[section] should result in the same object as `values`. - /// - /// @param values is the SectionValues map in which to search for values - /// @param section should correspond to INI section tag related to this config - /// @param key is the key to look up - /// @param bool constrains whether this key must exist - /// @param tolerateMultiples constrains whether multiples are allowed - /// @return the first matching entry if found or empty string if not found - /// @throws std::invalid_argument if constrants aren't met or if `section` is not found - const std::string& - getSingleSectionValue( - const SectionValues_t& values, - const std::string& section, - const std::string& key, - bool required, - bool tolerateMultiples = false) const; - private: bool Parse();