mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-25 15:06:21 +02:00
Code cleanup
This commit is contained in:
parent
a75e4857e6
commit
cd9f785425
7 changed files with 9 additions and 34 deletions
|
@ -26,31 +26,22 @@
|
|||
// text_exception uses a dynamically-allocated internal c-string for what():
|
||||
class SnapException : public std::exception
|
||||
{
|
||||
char* text_;
|
||||
std::string text_;
|
||||
|
||||
public:
|
||||
SnapException(const char* text)
|
||||
SnapException(const char* text) : text_(text)
|
||||
{
|
||||
text_ = new char[std::strlen(text) + 1];
|
||||
std::strcpy(text_, text);
|
||||
}
|
||||
|
||||
SnapException(const std::string& text) : SnapException(text.c_str())
|
||||
{
|
||||
}
|
||||
|
||||
SnapException(const SnapException& e) : SnapException(e.what())
|
||||
{
|
||||
}
|
||||
|
||||
~SnapException() throw() override
|
||||
{
|
||||
delete[] text_;
|
||||
}
|
||||
~SnapException() throw() override = default;
|
||||
|
||||
const char* what() const noexcept override
|
||||
{
|
||||
return text_;
|
||||
return text_.c_str();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -67,11 +58,6 @@ public:
|
|||
{
|
||||
}
|
||||
|
||||
AsyncSnapException(const AsyncSnapException& e) : SnapException(e.what())
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
~AsyncSnapException() throw() override = default;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue