Remove a couple unneeded functions

This commit is contained in:
Chris Robinson 2016-05-25 06:45:56 -07:00
parent ea83c959ca
commit 01f3e33df9
3 changed files with 7 additions and 24 deletions

View File

@ -829,8 +829,10 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
{
/* Add refcount on the new slot, and release the previous slot */
if(slot) IncrementRef(&slot->ref);
slot = ExchangePtr((XchgPtr*)&Source->Send[values[1]].Slot, slot);
if(slot) DecrementRef(&slot->ref);
if(Source->Send[values[1]].Slot)
DecrementRef(&Source->Send[values[1]].Slot->ref);
Source->Send[values[1]].Slot = slot;
/* We must force an update if the auxiliary slot changed on a
* playing source, in case the slot is about to be deleted.
*/
@ -839,8 +841,9 @@ static ALboolean SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp p
else
{
if(slot) IncrementRef(&slot->ref);
slot = ExchangePtr((XchgPtr*)&Source->Send[values[1]].Slot, slot);
if(slot) DecrementRef(&slot->ref);
if(Source->Send[values[1]].Slot)
DecrementRef(&Source->Send[values[1]].Slot->ref);
Source->Send[values[1]].Slot = slot;
DO_UPDATEPROPS();
}

View File

@ -8,6 +8,3 @@ extern inline void InitRef(RefCount *ptr, uint value);
extern inline uint ReadRef(RefCount *ptr);
extern inline uint IncrementRef(RefCount *ptr);
extern inline uint DecrementRef(RefCount *ptr);
extern inline int ExchangeInt(volatile int *ptr, int newval);
extern inline void *ExchangePtr(XchgPtr *ptr, void *newval);

View File

@ -305,23 +305,6 @@ inline uint DecrementRef(RefCount *ptr)
{ return ATOMIC_SUB(uint, ptr, 1)-1; }
/* NOTE: Not atomic! */
inline int ExchangeInt(volatile int *ptr, int newval)
{
int old = *ptr;
*ptr = newval;
return old;
}
typedef void *volatile XchgPtr;
/* NOTE: Not atomic! */
inline void *ExchangePtr(XchgPtr *ptr, void *newval)
{
void *old = *ptr;
*ptr = newval;
return old;
}
/* This is *NOT* atomic, but is a handy utility macro to compare-and-swap non-
* atomic variables. */
#define COMPARE_EXCHANGE(_val, _oldval, _newval) ((*(_val) == *(_oldval)) ? ((*(_val)=(_newval)),true) : ((*(_oldval)=*(_val)),false))