aboutsummaryrefslogtreecommitdiffstats
path: root/core/effectslot.cpp
diff options
context:
space:
mode:
authorSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
committerSven Göthel <[email protected]>2024-01-05 13:52:12 +0100
commitec98cdacc85ff0202852472c7756586437912f22 (patch)
tree42414746a27ab35cb8cdbc95af521d74821e57f4 /core/effectslot.cpp
parentfd5269bec9a5fe4815974b1786a037e6a247bfd2 (diff)
parentb82cd2e60edb8fbe5fdd3567105ae76a016a554c (diff)
Merge remote-tracking branch 'upstream/master'HEADmaster
Diffstat (limited to 'core/effectslot.cpp')
-rw-r--r--core/effectslot.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/core/effectslot.cpp b/core/effectslot.cpp
index db8aa078..6c80317e 100644
--- a/core/effectslot.cpp
+++ b/core/effectslot.cpp
@@ -3,7 +3,7 @@
#include "effectslot.h"
-#include <stddef.h>
+#include <cstddef>
#include "almalloc.h"
#include "context.h"
@@ -14,6 +14,8 @@ EffectSlotArray *EffectSlot::CreatePtrArray(size_t count) noexcept
/* Allocate space for twice as many pointers, so the mixer has scratch
* space to store a sorted list during mixing.
*/
- void *ptr{al_calloc(alignof(EffectSlotArray), EffectSlotArray::Sizeof(count*2))};
- return al::construct_at(static_cast<EffectSlotArray*>(ptr), count);
+ static constexpr auto AlignVal = std::align_val_t{alignof(EffectSlotArray)};
+ if(gsl::owner<void*> ptr{::operator new[](EffectSlotArray::Sizeof(count*2), AlignVal)})
+ return al::construct_at(static_cast<EffectSlotArray*>(ptr), count);
+ return nullptr;
}