Move assume_aligned to opthelpers.h and define force_inline
[openal-soft.git] / core / except.cpp
blob07bb410a444921172483d82e3ebbf43dde8f7103
2 #include "config.h"
4 #include "except.h"
6 #include <cstdio>
7 #include <cstdarg>
9 #include "opthelpers.h"
12 namespace al {
14 /* Defined here to avoid inlining it. */
15 base_exception::~base_exception() { }
17 void base_exception::setMessage(const char* msg, std::va_list args)
19 std::va_list args2;
20 va_copy(args2, args);
21 int msglen{std::vsnprintf(nullptr, 0, msg, args)};
22 if LIKELY(msglen > 0)
24 mMessage.resize(static_cast<size_t>(msglen)+1);
25 std::vsnprintf(&mMessage[0], mMessage.length(), msg, args2);
26 mMessage.pop_back();
28 va_end(args2);
31 } // namespace al