Changeset 26 for trunk/Classes/config_cache.cpp
- Timestamp:
- 2010-05-28 07:39:52 (2 years ago)
- File:
-
- 1 edited
-
trunk/Classes/config_cache.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Classes/config_cache.cpp
r23 r26 536 536 char *loadStringTable = NULL; 537 537 unsigned long totalStringSize=0; 538 std::map<std::string, int> stringTableHelper; 538 539 539 540 void cacheFreeStringTable(void) 540 541 { 541 542 stringTable.clear(); 543 stringTableHelper.clear(); 542 544 stringOffsets.clear(); 543 545 if (loadStringTable) … … 555 557 556 558 // check if vector contains element 557 std::vector<std::string>::iterator it; 558 it = std::find(stringTable.begin(), stringTable.end(), str); 559 if (it == stringTable.end()) 559 //std::vector<std::string>::iterator it; 560 //it = std::find(stringTable.begin(), stringTable.end(), str); 561 std::map<std::string, int>::iterator fnd; 562 fnd = stringTableHelper.lower_bound(str); 563 564 if (fnd != stringTableHelper.end() && !(stringTableHelper.key_comp()(str, fnd->first))) 565 { 566 //pos = it - stringTable.begin(); 567 pos = fnd->second; 568 } 569 else 560 570 { 561 571 stringTable.push_back(str); … … 563 573 pos = stringTable.size() - 1; 564 574 totalStringSize += str.size(); 565 } 566 else 567 { 568 pos = it - stringTable.begin(); 575 stringTableHelper.insert(fnd, std::make_pair<std::string, int>(str, pos)); 569 576 } 570 577
Note: See TracChangeset
for help on using the changeset viewer.