diff mbox series

[FFmpeg-devel,2.c/3] libavformat/protocols.c: avio_enum_protocols(): Move the loop variables

Message ID 3c6dd20cea674a09b98ec09c0f81b96a@gmail.com
State New
Headers show
Series [FFmpeg-devel,2.c/3] libavformat/protocols.c: avio_enum_protocols(): Move the loop variables | expand

Checks

Context Check Description
andriy/configure warning Failed to apply patch

Commit Message

Michael Witten Aug. 11, 2021, 7 p.m. UTC
The loop variables can now be moved into their respective
slots of the 'for(;;)' statement; this removes the need
for the 'done' label.

---
 libavformat/protocols.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 2aa302d08f..e3cde9ce02 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -95,19 +95,13 @@  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(;;) {
-    if (*p) {
+    for(; *p; ++p) {
         if ((output && (*p)->url_write) || (!output && (*p)->url_read)) {
             *opaque = (void *)p;
             return (*p)->name;
         }
-    } else {
-        goto done;
-    }
-    ++p;
     }
 
-done:
     *opaque = NULL;
     return NULL;
 }