[FFmpeg-devel] [PATCH 2.9/3] libavformat/protocols.c: avio_enum_protocols(): Reverse the conditional

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


The 'if(!*p)' has been turned into 'if (*p)'; of course,
this has necessitated the swapping of the branches.

---
 libavformat/protocols.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 5828113428..0deadbfbe7 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -96,14 +96,14 @@ const char *avio_enum_protocols(void **const opaque, const int output)
     typedef const URLProtocol *const *Iterator;
     Iterator p = *opaque ? (Iterator)(*opaque) + 1 : url_protocols;
 iterate:
-    if (!*p) {
-        *opaque = NULL;
-        return NULL;
-    } else {
+    if (*p) {
         if ((output && (*p)->url_write) || (!output && (*p)->url_read)) {
             *opaque = (void *)p;
             return (*p)->name;
         }
+    } else {
+        *opaque = NULL;
+        return NULL;
     }
     ++p;
     goto iterate;
-- 
2.22.0



More information about the ffmpeg-devel mailing list