diff options
Diffstat (limited to 'src/common/utils.cpp')
-rw-r--r-- | src/common/utils.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/common/utils.cpp b/src/common/utils.cpp index 21440a4..383c711 100644 --- a/src/common/utils.cpp +++ b/src/common/utils.cpp @@ -6,8 +6,6 @@ #include <algorithm> #include "../strings/fstring.hpp" -#include "../strings/tstring.hpp" -#include "../strings/sstring.hpp" #include "../strings/zstring.hpp" #include "../strings/xstring.hpp" @@ -65,27 +63,25 @@ int config_switch(ZString str) abort(); } -bool split_key_value(const FString& line, SString *w1, TString *w2) +bool split_key_value(ZString line, XString *w1, ZString *w2) { - FString::iterator begin = line.begin(), end = line.end(); - if (line.startswith("//")) return false; - if (begin == end) + if (!line) return false; - if (std::find_if(begin, end, + if (std::find_if(line.begin(), line.end(), [](unsigned char c) { return c < ' '; } ) != line.end()) return false; - FString::iterator colon = std::find(begin, end, ':'); - if (colon == end) + ZString::iterator colon = std::find(line.begin(), line.end(), ':'); + if (colon == line.end()) return false; - *w1 = line.oislice(begin, colon); + *w1 = line.xislice_h(colon); ++colon; while (std::isspace(*colon)) ++colon; - *w2 = line.oislice(colon, end); + *w2 = line.xislice_t(colon); return true; } |