Remove unnecessary copies of errorCodeTable
This commit is contained in:
parent
73e77f31eb
commit
c4fc36ed23
|
@ -107,14 +107,14 @@ ErrorCodeTable& Error::errorCodeTable() {
|
|||
}
|
||||
|
||||
const char* Error::name() const {
|
||||
auto table = errorCodeTable();
|
||||
const auto& table = errorCodeTable();
|
||||
auto it = table.find(error_code);
|
||||
if (it == table.end()) return "UNKNOWN_ERROR";
|
||||
return it->second.first;
|
||||
}
|
||||
|
||||
const char* Error::what() const {
|
||||
auto table = errorCodeTable();
|
||||
const auto& table = errorCodeTable();
|
||||
auto it = table.find(error_code);
|
||||
if (it == table.end()) return "UNKNOWN_ERROR";
|
||||
return it->second.second;
|
||||
|
|
Loading…
Reference in New Issue