diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2013-10-04 21:03:31 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2013-10-05 13:42:46 -0700 |
commit | 70214054e84b920ca3bea5119bd5d1456c809054 (patch) | |
tree | 0a9383d460c8988f788f4ef7adcd567526b35a75 /src/common/utils.cpp | |
parent | caae1e38d0d239f4f7088a64526fe1d2f6587999 (diff) | |
download | tmwa-70214054e84b920ca3bea5119bd5d1456c809054.tar.gz tmwa-70214054e84b920ca3bea5119bd5d1456c809054.tar.bz2 tmwa-70214054e84b920ca3bea5119bd5d1456c809054.tar.xz tmwa-70214054e84b920ca3bea5119bd5d1456c809054.zip |
Remove owning slices
They were hardly ever used, hid errors, and were obsoleted by baseful x'es.
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; } |