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

View File

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