aboutsummaryrefslogtreecommitdiffstats
path: root/alc/hrtf.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-09-11 03:59:53 -0700
committerChris Robinson <[email protected]>2019-09-11 03:59:53 -0700
commit5b37e2339bc91de3424b51600c3d3b96401d0b9c (patch)
tree4f816457b227ee511563b9b6f0d3fa91bd70b814 /alc/hrtf.cpp
parentc6c50484160435ee96e51eece154013fe6e48237 (diff)
Simplify flexible array member usage
Diffstat (limited to 'alc/hrtf.cpp')
-rw-r--r--alc/hrtf.cpp19
1 files changed, 4 insertions, 15 deletions
diff --git a/alc/hrtf.cpp b/alc/hrtf.cpp
index 5a39f686..04818a4f 100644
--- a/alc/hrtf.cpp
+++ b/alc/hrtf.cpp
@@ -61,22 +61,12 @@ struct HrtfHandle {
HrtfHandle(const HrtfHandle&) = delete;
HrtfHandle& operator=(const HrtfHandle&) = delete;
- static std::unique_ptr<HrtfHandle> Create(size_t fname_len);
- static constexpr size_t Sizeof(size_t length) noexcept
- {
- return maxz(sizeof(HrtfHandle),
- al::FlexArray<char>::Sizeof(length, offsetof(HrtfHandle, filename)));
- }
+ static std::unique_ptr<HrtfHandle> Create(size_t fname_len)
+ { return std::unique_ptr<HrtfHandle>{new (FamCount{fname_len}) HrtfHandle{fname_len}}; }
- DEF_PLACE_NEWDEL()
+ DEF_FAM_NEWDEL(HrtfHandle, filename)
};
-std::unique_ptr<HrtfHandle> HrtfHandle::Create(size_t fname_len)
-{
- void *ptr{al_calloc(alignof(HrtfHandle), HrtfHandle::Sizeof(fname_len))};
- return std::unique_ptr<HrtfHandle>{new (ptr) HrtfHandle{fname_len}};
-}
-
namespace {
using namespace std::placeholders;
@@ -294,8 +284,7 @@ void GetHrtfCoeffs(const HrtfEntry *Hrtf, ALfloat elevation, ALfloat azimuth, AL
std::unique_ptr<DirectHrtfState> DirectHrtfState::Create(size_t num_chans)
{
- void *ptr{al_calloc(16, DirectHrtfState::Sizeof(num_chans))};
- return std::unique_ptr<DirectHrtfState>{new (ptr) DirectHrtfState{num_chans}};
+ return std::unique_ptr<DirectHrtfState>{new (FamCount{num_chans}) DirectHrtfState{num_chans}};
}
void BuildBFormatHrtf(const HrtfEntry *Hrtf, DirectHrtfState *state, const ALuint NumChannels,