From 98c2fa095d7fdf4ec8cc957466cadd04f0eacea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9Fschuh?= Date: Sat, 14 Jan 2023 18:19:40 +0000 Subject: ao: remove trailing NULL element from driver array --- audio/out/ao.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'audio/out/ao.c') diff --git a/audio/out/ao.c b/audio/out/ao.c index 768f98acb3..a5aa3a9402 100644 --- a/audio/out/ao.c +++ b/audio/out/ao.c @@ -102,12 +102,11 @@ static const struct ao_driver * const audio_out_drivers[] = { #endif &audio_out_pcm, &audio_out_lavc, - NULL }; static bool get_desc(struct m_obj_desc *dst, int index) { - if (index >= MP_ARRAY_SIZE(audio_out_drivers) - 1) + if (index >= MP_ARRAY_SIZE(audio_out_drivers)) return false; const struct ao_driver *ao = audio_out_drivers[index]; *dst = (struct m_obj_desc) { @@ -313,7 +312,7 @@ struct ao *ao_init_best(struct mpv_global *global, } if (autoprobe) { - for (int n = 0; audio_out_drivers[n]; n++) { + for (int n = 0; n < MP_ARRAY_SIZE(audio_out_drivers); n++) { const struct ao_driver *driver = audio_out_drivers[n]; if (driver == &audio_out_null) break; @@ -521,7 +520,7 @@ struct ao_device_list *ao_hotplug_get_device_list(struct ao_hotplug *hp, } } - for (int n = 0; audio_out_drivers[n]; n++) { + for (int n = 0; n < MP_ARRAY_SIZE(audio_out_drivers); n++) { const struct ao_driver *d = audio_out_drivers[n]; if (d == &audio_out_null) break; // don't add unsafe/special entries -- cgit v1.2.3