From fd2f1a6f9af5087ca8e6e878176db6308fd4b45a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Tue, 17 Jan 2023 06:21:42 +0000 Subject: [PATCH] stream: remove trailing NULL element from stream list --- stream/stream.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/stream/stream.c b/stream/stream.c index 116dcef4a4..436bc7f779 100644 --- a/stream/stream.c +++ b/stream/stream.c @@ -92,7 +92,6 @@ static const stream_info_t *const stream_list[] = { &stream_info_slice, &stream_info_fd, &stream_info_cb, - NULL }; // Because of guarantees documented on STREAM_BUFFER_SIZE. @@ -423,7 +422,7 @@ int stream_create_with_args(struct stream_open_args *args, struct stream **ret) if (args->sinfo) { r = stream_create_instance(args->sinfo, args, ret); } else { - for (int i = 0; stream_list[i]; i++) { + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { r = stream_create_instance(stream_list[i], args, ret); if (r == STREAM_OK) break; @@ -852,7 +851,7 @@ char **stream_get_proto_list(void) { char **list = NULL; int num = 0; - for (int i = 0; stream_list[i]; i++) { + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { const stream_info_t *stream_info = stream_list[i]; if (!stream_info->protocols) @@ -887,7 +886,7 @@ void stream_print_proto_list(struct mp_log *log) bool stream_has_proto(const char *proto) { - for (int i = 0; stream_list[i]; i++) { + for (int i = 0; i < MP_ARRAY_SIZE(stream_list); i++) { const stream_info_t *stream_info = stream_list[i]; for (int j = 0; stream_info->protocols && stream_info->protocols[j]; j++) {