[FFmpeg-devel] [PATCH 2.d/3] libavformat/protocols.c: avio_enum_protocols(): Move loop initialization

Michael Witten mfwitten at gmail.com
Wed Aug 11 22:00:15 EEST 2021


For the sake of completeness and scope correctness, the declaration
and initialization of 'p' has been moved into the 'for(;;)' statement.

---
 libavformat/protocols.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index e3cde9ce02..9ce98968fa 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -94,8 +94,7 @@ const AVClass *ff_urlcontext_child_class_iterate(void **iter)
 const char *avio_enum_protocols(void **const opaque, const int output)
 {
     typedef const URLProtocol *const *Iterator;
-    Iterator p = *opaque ? (Iterator)(*opaque) + 1 : url_protocols;
-    for(; *p; ++p) {
+    for(Iterator p = *opaque ? (Iterator)(*opaque) + 1 : url_protocols; *p; ++p) {
         if ((output && (*p)->url_write) || (!output && (*p)->url_read)) {
             *opaque = (void *)p;
             return (*p)->name;
-- 
2.22.0



More information about the ffmpeg-devel mailing list