aboutsummaryrefslogtreecommitdiff
path: root/contrib/epee
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-08-19 22:40:30 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2018-10-24 08:34:25 +0000
commit07c6280909f8d6bb4d4d8e2399b56a0ce02393c6 (patch)
treedf76f6f2b011ca011c98e8d897dcbc14fd450131 /contrib/epee
parentMerge pull request #4697 (diff)
downloadmonero-07c6280909f8d6bb4d4d8e2399b56a0ce02393c6.tar.xz
epee: some minor speedup in parsing
Diffstat (limited to 'contrib/epee')
-rw-r--r--contrib/epee/include/storages/parserse_base_utils.h6
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)
{