mirror of
https://codeberg.org/anoncontributorxmr/monero.git
synced 2024-11-27 05:13:25 +01:00
epee: speed up string matching a bit
This commit is contained in:
parent
3a3858dc90
commit
a13eb0a1a4
@ -91,11 +91,15 @@ namespace misc_utils
|
|||||||
*/
|
*/
|
||||||
inline void match_string2(std::string::const_iterator& star_end_string, std::string::const_iterator buf_end, std::string& val)
|
inline void match_string2(std::string::const_iterator& star_end_string, std::string::const_iterator buf_end, std::string& val)
|
||||||
{
|
{
|
||||||
val.clear();
|
|
||||||
val.reserve(std::distance(star_end_string, buf_end));
|
|
||||||
bool escape_mode = false;
|
bool escape_mode = false;
|
||||||
std::string::const_iterator it = star_end_string;
|
std::string::const_iterator it = star_end_string;
|
||||||
++it;
|
++it;
|
||||||
|
std::string::const_iterator fi = it;
|
||||||
|
while (fi != buf_end && *fi != '\\' && *fi != '\"')
|
||||||
|
++fi;
|
||||||
|
val.assign(it, fi);
|
||||||
|
val.reserve(std::distance(star_end_string, buf_end));
|
||||||
|
it = fi;
|
||||||
for(;it != buf_end;it++)
|
for(;it != buf_end;it++)
|
||||||
{
|
{
|
||||||
if(escape_mode/*prev_ch == '\\'*/)
|
if(escape_mode/*prev_ch == '\\'*/)
|
||||||
|
Loading…
Reference in New Issue
Block a user