Message ID | a3da50174976446d8b5d2b5d802d50a2@gmail.com |
---|---|
State | New |
Headers | show |
Series | [FFmpeg-devel,2.b/3] libavformat/protocols.c: avio_enum_protocols(): Convert the 'goto' loop to a 'for(; ; )' block | expand |
Context | Check | Description |
---|---|---|
andriy/configure | warning | Failed to apply patch |
11 Aug 2021, 21:00 by mfwitten@gmail.com: > The indentation will be cleaned up in the next commit. > > --- > libavformat/protocols.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/libavformat/protocols.c b/libavformat/protocols.c > index 032f07bf72..2aa302d08f 100644 > --- a/libavformat/protocols.c > +++ b/libavformat/protocols.c > @@ -95,7 +95,7 @@ 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: > + for(;;) { > if (*p) { > if ((output && (*p)->url_write) || (!output && (*p)->url_read)) { > *opaque = (void *)p; > @@ -105,7 +105,7 @@ iterate: > goto done; > } > ++p; > - goto iterate; > + } > > done: > *opaque = NULL; > while (1) please. Let's not add more for (;;) loops.
| Michael Witten: | | > -iterate: | > + for(;;) { | > if (*p) { | > if ((output && (*p)->url_write) || (!output && (*p)->url_read)) { | > *opaque = (void *)p; | > @@ -105,7 +105,7 @@ iterate: | > goto done; | > } | > ++p; | > - goto iterate; | > + } | | Lynn: | | > while (1) please. Let's not add more for (;;) loops. This is just an intermediate patch. Future patches populate the slots or clauses of the 'for' statement, and if these small patches are squashed together (or relegated by a proper merge commit), then the 'for(;;)' will no longer be part of the master history. Sincerely, Michael Witten PS Long ago, I read someone's view on the debate between the options: * while (1) * for (;;) That person remarked that he reads "(;;)" as "ever", so that the whole statement "for (;;)" reads as "forever"; in addition, it is 1 character shorter than "while (1)".
diff --git a/libavformat/protocols.c b/libavformat/protocols.c index 032f07bf72..2aa302d08f 100644 --- a/libavformat/protocols.c +++ b/libavformat/protocols.c @@ -95,7 +95,7 @@ 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: + for(;;) { if (*p) { if ((output && (*p)->url_write) || (!output && (*p)->url_read)) { *opaque = (void *)p; @@ -105,7 +105,7 @@ iterate: goto done; } ++p; - goto iterate; + } done: *opaque = NULL;