improve Util::abort
This commit is contained in:
parent
aeb07d43a7
commit
4ade4945a0
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user