diff mbox series

[FFmpeg-devel,2.4/3] libavformat/protocols.c: avio_enum_protocols(): Consolidate initialization of 'p'

Message ID 7668e56bf2834e0683cc7ffc78f5f2b4@gmail.com
State New
Headers show
Series [FFmpeg-devel,2.1/3] libavformat/protocols.c: avio_enum_protocols(): Split declaration and initialization | expand

Checks

Context Check Description
andriy/configure warning Failed to apply patch

Commit Message

Michael Witten Aug. 11, 2021, 7 p.m. UTC
Now that the label has been moved past the initial assignment of 'p',
it is possible to consolidate both the declaration and initialization.

A typedef is used to simplify the declaration of 'p', and to help the
reader understand what the purpose of 'p' is.

---
 libavformat/protocols.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index 7e90cb067d..5e4bf5cbae 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -93,10 +93,8 @@  const AVClass *ff_urlcontext_child_class_iterate(void **iter)
 
 const char *avio_enum_protocols(void **const opaque, const int output)
 {
-    const URLProtocol *const *p;
-
-    p = *opaque;
-    p = p ? p + 1 : url_protocols;
+    typedef const URLProtocol *const *Iterator;
+    Iterator p = *opaque ? (Iterator)(*opaque) + 1 : url_protocols;
 iterate:
     *opaque = (void *)p;
     if (!*p) {