Bugzilla – Bug 2549
dead assignment on dsr-routing.cc
Last modified: 2017-04-17 20:27:53 UTC
The snippet is the following: 533 std::vector<std::string> 534 DsrRouting::GetElementsFromContext (std::string context) 535 { 536 std::vector <std::string> elements; 537 size_t pos1=0, pos2; 538 while (pos1 != context.npos) 539 { 540 pos1 = context.find ("/",pos1); 541 pos2 = context.find ("/",pos1+1); 542 elements.push_back (context.substr (pos1+1,pos2-(pos1+1))); 543 pos1 = pos2; 544 pos2 = context.npos; // Value stored to 'pos2' is never read 545 } 546 return elements; 547 } At line 544, we have an assignment, but it is dead because at the next iteration it will be overwritten by another search. Is it safe to remove line 544, or there is room the rewrite the function in a more compact way, without calling two times find ?
was fixed a while back in changeset 12699:16407cde2596