Skip to content
Snippets Groups Projects

Use find_if instead of for+break and fix possible segfault

2 unresolved threads

Closes #142 (closed)

Merge request reports

Pipeline #2012745 passed

Pipeline passed for cda96b72 on clemenci:142-improve-ToolVisitorTest-logic

Closed by Marco ClemencicMarco Clemencic 4 years ago (Oct 15, 2020 9:57am UTC)

Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
42 42 pos = pos2;
43 43 }
44 44 if ( pos != std::string::npos ) {
45 45 return std::string( &( full_name.c_str()[pos + 1] ), full_name.size() - pos - 1 );
  • This looks like a very complicated way of writing:

    Suggested change
    45 return std::string( &( full_name.c_str()[pos + 1] ), full_name.size() - pos - 1 );
    45 return full_name.substr(pos+1);
  • Please register or sign in to reply
  • 29 29 if ( !condition ) {
    30 30 std::stringstream msg;
    31 31 msg << "Conditoin Failed: " << file_name << ":" << line_no << " " << condition_string;
    32 32 throw std::runtime_error( msg.str() );
    • Suggested change
      30 std::stringstream msg;
      31 msg << "Conditoin Failed: " << file_name << ":" << line_no << " " << condition_string;
      32 throw std::runtime_error( msg.str() );
      30 throw std::runtime_error( fmt::format( "Condition Failed: {}:{} {}",file_name,line_no,condition_string));

      with of course #include "fmt/format.h" somewhere at the start of the file...

    • Please register or sign in to reply
  • Edited by Software for LHCb
  • Close in favour of !1135 (merged)

  • Please register or sign in to reply
    Loading