OSDN Git Service

avutil/get_pool: Remove redundant initial atomic operation
authorMichael Niedermayer <michaelni@gmx.at>
Sun, 17 Mar 2013 15:37:06 +0000 (16:37 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Sun, 17 Mar 2013 17:40:15 +0000 (18:40 +0100)
602->442 dezicycles

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/buffer.c

index d268a7f..3475e57 100644 (file)
@@ -239,14 +239,14 @@ void av_buffer_pool_uninit(AVBufferPool **ppool)
 /* remove the whole buffer list from the pool and return it */
 static BufferPoolEntry *get_pool(AVBufferPool *pool)
 {
-    BufferPoolEntry *cur = NULL, *last = NULL;
+    BufferPoolEntry *cur = *(void * volatile *)&pool->pool, *last = NULL;
 
-    do {
+    while (cur != last) {
         FFSWAP(BufferPoolEntry*, cur, last);
         cur = avpriv_atomic_ptr_cas((void * volatile *)&pool->pool, last, NULL);
         if (!cur)
             return NULL;
-    } while (cur != last);
+    }
 
     return cur;
 }