diff options
author | Chris Robinson <[email protected]> | 2019-09-01 17:54:17 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2019-09-01 17:54:17 -0700 |
commit | bb35e24c9ba7ec01c05fc1f07ef737c15821283a (patch) | |
tree | 446a56e69f7cce88a07ada7848298cdfbc9a775a /al | |
parent | 727217ce0a9765270551ad6e10a25ee0b7fb74e6 (diff) |
Avoid unnecessary placement new definitions
Diffstat (limited to 'al')
-rw-r--r-- | al/auxeffectslot.cpp | 7 | ||||
-rw-r--r-- | al/auxeffectslot.h | 2 | ||||
-rw-r--r-- | al/source.cpp | 7 |
3 files changed, 3 insertions, 13 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index b2f2c249..3eb8b80a 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -173,13 +173,9 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context) { return entry.FreeMask != 0; } ); auto lidx = static_cast<ALsizei>(std::distance(context->mEffectSlotList.begin(), sublist)); - ALeffectslot *slot; ALsizei slidx; if LIKELY(sublist != context->mEffectSlotList.end()) - { slidx = CTZ64(sublist->FreeMask); - slot = sublist->EffectSlots + slidx; - } else { /* Don't allocate so many list entries that the 32-bit ID could @@ -203,10 +199,9 @@ ALeffectslot *AllocEffectSlot(ALCcontext *context) } slidx = 0; - slot = sublist->EffectSlots + slidx; } - slot = new (slot) ALeffectslot{}; + ALeffectslot *slot{::new (sublist->EffectSlots + slidx) ALeffectslot{}}; ALenum err{InitEffectSlot(slot)}; if(err != AL_NO_ERROR) { diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h index a6eb94f9..2471447f 100644 --- a/al/auxeffectslot.h +++ b/al/auxeffectslot.h @@ -92,7 +92,7 @@ struct ALeffectslot { static ALeffectslotArray *CreatePtrArray(size_t count) noexcept; - DEF_PLACE_NEWDEL() + DEF_NEWDEL(ALeffectslot) }; ALenum InitEffectSlot(ALeffectslot *slot); diff --git a/al/source.cpp b/al/source.cpp index 010dee1c..86a7d94c 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -491,13 +491,9 @@ ALsource *AllocSource(ALCcontext *context) { return entry.FreeMask != 0; } ); auto lidx = static_cast<ALsizei>(std::distance(context->mSourceList.begin(), sublist)); - ALsource *source; ALsizei slidx; if LIKELY(sublist != context->mSourceList.end()) - { slidx = CTZ64(sublist->FreeMask); - source = sublist->Sources + slidx; - } else { /* Don't allocate so many list entries that the 32-bit ID could @@ -521,10 +517,9 @@ ALsource *AllocSource(ALCcontext *context) } slidx = 0; - source = sublist->Sources + slidx; } - source = new (source) ALsource{device->NumAuxSends}; + ALsource *source{::new (sublist->Sources + slidx) ALsource{device->NumAuxSends}}; /* Add 1 to avoid source ID 0. */ source->id = ((lidx<<6) | slidx) + 1; |