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

Rostislav Pehlivanov atomnuker at gmail.com
Mon Nov 27 06:30:21 EET 2017


Same as last 2 commits.

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

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)
-- 
2.15.0.417.g466bffb3ac



More information about the ffmpeg-devel mailing list