improve Util::abort

This commit is contained in:
Tiago Gomes 2012-05-07 17:52:47 +01:00
parent aeb07d43a7
commit 4ade4945a0
2 changed files with 7 additions and 7 deletions

View File

@ -55,9 +55,7 @@ stringToUnsigned (string str)
stringstream ss;
ss << str;
ss >> val;
if (val < 0) {
abort ("error: the value tried to read is negative");
}
abort ("error: the value tried to read is negative", val < 0);
return static_cast<unsigned> (val);
}
@ -297,10 +295,12 @@ setHorusFlag (string key, string value)
void
abort (string msg)
abort (string msg, bool b)
{
cerr << msg << endl;
std::abort();
if (b) {
cerr << msg << endl;
std::abort();
}
}

View File

@ -78,7 +78,7 @@ vector<string> getStateLines (const Vars&);
bool setHorusFlag (string key, string value);
void abort (string msg);
void abort (string msg, bool = true);
void printHeader (string, std::ostream& os = std::cout);