diff mbox

[FFmpeg-devel,4/4] lavc/utils: simplify codec registration

Message ID 20171127043021.20321-4-atomnuker@gmail.com
State New
Headers show

Commit Message

Rostislav Pehlivanov Nov. 27, 2017, 4:30 a.m. UTC
Same as last 2 commits.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
---
 libavcodec/utils.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index baf09119fe..de2dcea54d 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -185,8 +185,11 @@  av_cold void avcodec_register(AVCodec *codec)
     p = last_avcodec;
     codec->next = NULL;
 
-    while(*p || avpriv_atomic_ptr_cas((void * volatile *)p, NULL, codec))
-        p = &(*p)->next;
+    /* Iterate through the list until the last entry has been reached */
+    do {
+        *p = codec;
+        p  = &(codec)->next;
+    } while (*p);
     last_avcodec = &codec->next;
 
     if (codec->init_static_data)