diff options
author | Riccardo Spagni <ric@spagni.net> | 2018-11-06 14:50:57 +0200 |
---|---|---|
committer | Riccardo Spagni <ric@spagni.net> | 2018-11-06 14:50:57 +0200 |
commit | 7ceeaec2e5a057210f76f9b30721205b811ff43d (patch) | |
tree | 1d1decf5879ab138145f303878bbdf8b97d91450 /contrib | |
parent | Merge pull request #4708 (diff) | |
parent | epee: some minor speedup in parsing (diff) | |
download | monero-7ceeaec2e5a057210f76f9b30721205b811ff43d.tar.xz |
Merge pull request #4709
07c62809 epee: some minor speedup in parsing (moneromooo-monero)
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/epee/include/storages/parserse_base_utils.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/contrib/epee/include/storages/parserse_base_utils.h b/contrib/epee/include/storages/parserse_base_utils.h index 8c6c1a64d..31495ae13 100644 --- a/contrib/epee/include/storages/parserse_base_utils.h +++ b/contrib/epee/include/storages/parserse_base_utils.h @@ -39,12 +39,14 @@ namespace misc_utils inline std::string transform_to_escape_sequence(const std::string& src) { static const char escaped[] = "\b\f\n\r\t\v\"\\/"; - if (std::find_first_of(src.begin(), src.end(), escaped, escaped + sizeof(escaped)) == src.end()) + std::string::const_iterator it = std::find_first_of(src.begin(), src.end(), escaped, escaped + sizeof(escaped)); + if (it == src.end()) return src; std::string res; res.reserve(2 * src.size()); - for(std::string::const_iterator it = src.begin(); it!=src.end(); ++it) + res.assign(src.begin(), it); + for(; it!=src.end(); ++it) { switch(*it) { |