[FFmpeg-devel] [PATCH 2.3/3] libavformat/protocols.c: avio_enum_protocols(): Move 'iterate' label
Michael Witten
mfwitten at gmail.com
Wed Aug 11 22:00:05 EEST 2021
Upon iteration ('goto iterate;'), it is known that 'p' is non-zero,
so there is no point in doing the check; it is known that 'p' must
be incremented. Therefore, the 'iterate' label may be moved past
the ternary operator, provided that '++p;' is added just before
the 'goto', so as to perform the required incrementing.
---
libavformat/protocols.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/protocols.c b/libavformat/protocols.c
index b0aae66dab..7e90cb067d 100644
--- a/libavformat/protocols.c
+++ b/libavformat/protocols.c
@@ -95,9 +95,9 @@ const char *avio_enum_protocols(void **const opaque, const int output)
{
const URLProtocol *const *p;
-iterate:
p = *opaque;
p = p ? p + 1 : url_protocols;
+iterate:
*opaque = (void *)p;
if (!*p) {
*opaque = NULL;
@@ -105,6 +105,7 @@ iterate:
}
if ((output && (*p)->url_write) || (!output && (*p)->url_read))
return (*p)->name;
+ ++p;
goto iterate;
}
--
2.22.0
More information about the ffmpeg-devel
mailing list