Commit 56e432b2 authored by Clément Bœsch's avatar Clément Bœsch

avutil/atomic: reuse ret to avoid dereferencing twice the same value.

parent cc914885
...@@ -64,7 +64,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval) ...@@ -64,7 +64,7 @@ void *avpriv_atomic_ptr_cas(void * volatile *ptr, void *oldval, void *newval)
void *ret; void *ret;
pthread_mutex_lock(&atomic_lock); pthread_mutex_lock(&atomic_lock);
ret = *ptr; ret = *ptr;
if (*ptr == oldval) if (ret == oldval)
*ptr = newval; *ptr = newval;
pthread_mutex_unlock(&atomic_lock); pthread_mutex_unlock(&atomic_lock);
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment