In C, it's generally not good to write a recursive algorithm, because it is not possible to rely on the compiler to elide a tail call; therefore, this commit converts a tail call into an iterative loop by means of an explicit 'goto' statement. --- libavformat/protocols.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 1c5e3b2bdb..b0aae66dab 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -95,6 +95,7 @@ const char *avio_enum_protocols(void **const opaque, const int output) { const URLProtocol *const *p; +iterate: p = *opaque; p = p ? p + 1 : url_protocols; *opaque = (void *)p; @@ -104,7 +105,7 @@ const char *avio_enum_protocols(void **const opaque, const int output) } if ((output && (*p)->url_write) || (!output && (*p)->url_read)) return (*p)->name; - return avio_enum_protocols(opaque, output); + goto iterate; } const AVClass *avio_protocol_get_class(const char *name) -- 2.22.0 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".