Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvng <viktor.govako@gmail.com>2011-09-01 15:13:22 +0400
committerAlex Zolotarev <alex@maps.me>2015-09-23 01:22:50 +0300
commita1ee16f983ebaacaa78e92aa0d500a828dc90ca0 (patch)
tree2f9c9b348932efd8c88a59a7bcfc1f2af20c7789 /indexer/drawing_rule_def.cpp
parent3ddb66dc3740286ebdb799d0d2839b7f6b78604d (diff)
Make classificator initialization faster.
Diffstat (limited to 'indexer/drawing_rule_def.cpp')
-rw-r--r--indexer/drawing_rule_def.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/indexer/drawing_rule_def.cpp b/indexer/drawing_rule_def.cpp
index 5484d40885..0b11b17d56 100644
--- a/indexer/drawing_rule_def.cpp
+++ b/indexer/drawing_rule_def.cpp
@@ -22,15 +22,21 @@ namespace drule
void Key::fromString(string const & s)
{
int * arrParams[] = { &m_scale, &m_type, &m_index, &m_priority };
+ size_t const count = s.size();
- strings::SimpleTokenizer it(s, "|");
+ size_t beg = 0;
size_t i = 0;
- while (it)
+ do
{
+ size_t end = s.find_first_of('|', beg);
+ if (end == string::npos)
+ end = count;
+
ASSERT ( i < ARRAY_SIZE(arrParams), (i) );
+ //*(arrParams[i++]) = atoi(s.substr(beg, end - beg).c_str());
+ *(arrParams[i++]) = strtol(&s[beg], 0, 10);
- *(arrParams[i++]) = atoi((*it).c_str());
- ++it;
- }
+ beg = end + 1;
+ } while (beg < count);
}
}