diff options
author | est31 <MTest31@outlook.com> | 2015-06-01 16:58:57 +0200 |
---|---|---|
committer | est31 <MTest31@outlook.com> | 2015-06-01 17:04:21 +0200 |
commit | 617a3d426f93cb5c5c6206c3c8cefb8900639639 (patch) | |
tree | 8898403b1fbc88f6df6f4e3193798c5d84f35107 | |
parent | 06a2eee692e0e55c1dfb9f14e982ad146ba4ce49 (diff) | |
download | minetest-617a3d426f93cb5c5c6206c3c8cefb8900639639.tar.gz minetest-617a3d426f93cb5c5c6206c3c8cefb8900639639.tar.bz2 minetest-617a3d426f93cb5c5c6206c3c8cefb8900639639.zip |
Make split method static
-rw-r--r-- | src/guiFormSpecMenu.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/guiFormSpecMenu.cpp b/src/guiFormSpecMenu.cpp index d53c9b3af..ac230e425 100644 --- a/src/guiFormSpecMenu.cpp +++ b/src/guiFormSpecMenu.cpp @@ -236,28 +236,27 @@ GUITable* GUIFormSpecMenu::getTable(std::wstring tablename) return 0; } -std::vector<std::string> split(const std::string &s, char delim) { +static std::vector<std::string> split(const std::string &s, char delim) +{ std::vector<std::string> tokens; std::string current = ""; bool last_was_escape = false; - for(unsigned int i=0; i < s.size(); i++) { + for (unsigned int i = 0; i < s.size(); i++) { + char si = s.c_str()[i]; if (last_was_escape) { current += '\\'; - current += s.c_str()[i]; + current += si; last_was_escape = false; - } - else { - if (s.c_str()[i] == delim) { + } else { + if (si == delim) { tokens.push_back(current); current = ""; last_was_escape = false; - } - else if (s.c_str()[i] == '\\'){ + } else if (si == '\\') { last_was_escape = true; - } - else { - current += s.c_str()[i]; + } else { + current += si; last_was_escape = false; } } |