aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2019-08-13 22:25:59 -0700
committerChris Robinson <[email protected]>2019-08-13 22:25:59 -0700
commit351ccf2e11cfc429eeb76f7812565d0ed27043d5 (patch)
treeb3ff80b389c5ba41bed0d61031ff3b0c028c4759
parentecab99bce914c6c74351fb2d5878dd82d73b1fe2 (diff)
Use new/delete for context and effectslot properties
-rw-r--r--al/auxeffectslot.cpp4
-rw-r--r--al/auxeffectslot.h2
-rw-r--r--al/state.cpp2
-rw-r--r--alc/alc.cpp6
-rw-r--r--alc/alcontext.h2
5 files changed, 10 insertions, 6 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp
index e2dccb4d..b2f2c249 100644
--- a/al/auxeffectslot.cpp
+++ b/al/auxeffectslot.cpp
@@ -711,7 +711,7 @@ ALeffectslot::~ALeffectslot()
{
if(props->State) props->State->release();
TRACE("Freed unapplied AuxiliaryEffectSlot update %p\n", props);
- al_free(props);
+ delete props;
}
if(Effect.State)
@@ -725,7 +725,7 @@ void UpdateEffectSlotProps(ALeffectslot *slot, ALCcontext *context)
/* Get an unused property container, or allocate a new one as needed. */
ALeffectslotProps *props{context->mFreeEffectslotProps.load(std::memory_order_relaxed)};
if(!props)
- props = static_cast<ALeffectslotProps*>(al_calloc(16, sizeof(*props)));
+ props = new ALeffectslotProps{};
else
{
ALeffectslotProps *next;
diff --git a/al/auxeffectslot.h b/al/auxeffectslot.h
index 9acb6d6b..a6eb94f9 100644
--- a/al/auxeffectslot.h
+++ b/al/auxeffectslot.h
@@ -32,6 +32,8 @@ struct ALeffectslotProps {
EffectState *State;
std::atomic<ALeffectslotProps*> next;
+
+ DEF_NEWDEL(ALeffectslotProps)
};
diff --git a/al/state.cpp b/al/state.cpp
index 884aa9d2..64cbae6e 100644
--- a/al/state.cpp
+++ b/al/state.cpp
@@ -827,7 +827,7 @@ void UpdateContextProps(ALCcontext *context)
/* Get an unused proprty container, or allocate a new one as needed. */
ALcontextProps *props{context->mFreeContextProps.load(std::memory_order_acquire)};
if(!props)
- props = static_cast<ALcontextProps*>(al_calloc(16, sizeof(*props)));
+ props = new ALcontextProps{};
else
{
ALcontextProps *next;
diff --git a/alc/alc.cpp b/alc/alc.cpp
index baf31993..9be224d5 100644
--- a/alc/alc.cpp
+++ b/alc/alc.cpp
@@ -2322,14 +2322,14 @@ ALCcontext::~ALCcontext()
if(cprops)
{
TRACE("Freed unapplied context update %p\n", cprops);
- al_free(cprops);
+ delete cprops;
}
size_t count{0};
cprops = mFreeContextProps.exchange(nullptr, std::memory_order_acquire);
while(cprops)
{
ALcontextProps *next{cprops->next.load(std::memory_order_relaxed)};
- al_free(cprops);
+ delete cprops;
cprops = next;
++count;
}
@@ -2350,7 +2350,7 @@ ALCcontext::~ALCcontext()
{
ALeffectslotProps *next{eprops->next.load(std::memory_order_relaxed)};
if(eprops->State) eprops->State->release();
- al_free(eprops);
+ delete eprops;
eprops = next;
++count;
}
diff --git a/alc/alcontext.h b/alc/alcontext.h
index f30a4bd0..c91d0a21 100644
--- a/alc/alcontext.h
+++ b/alc/alcontext.h
@@ -50,6 +50,8 @@ struct ALcontextProps {
DistanceModel mDistanceModel;
std::atomic<ALcontextProps*> next;
+
+ DEF_NEWDEL(ALcontextProps)
};