From bf327d3dfbbee6642d5a3486c874c9e15d0b25ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Wed, 13 Aug 2025 15:35:04 +0200 Subject: [PATCH] spa: libcamera: source: simplify `spa_libcamera_clear_buffers()` Remove the unused `impl` parameter and the unnecessary early return. --- spa/plugins/libcamera/libcamera-source.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/spa/plugins/libcamera/libcamera-source.cpp b/spa/plugins/libcamera/libcamera-source.cpp index a16ce7971..18cca35ea 100644 --- a/spa/plugins/libcamera/libcamera-source.cpp +++ b/spa/plugins/libcamera/libcamera-source.cpp @@ -371,14 +371,9 @@ err: return res; } -int spa_libcamera_clear_buffers(struct impl *impl, struct port *port) +int spa_libcamera_clear_buffers(struct port *port) { - uint32_t i; - - if (port->n_buffers == 0) - return 0; - - for (i = 0; i < port->n_buffers; i++) { + for (std::size_t i = 0; i < port->n_buffers; i++) { struct buffer *b; struct spa_data *d; @@ -1833,7 +1828,7 @@ int port_set_format(struct impl *impl, struct port *port, if (!try_only) { spa_libcamera_stream_off(impl); - spa_libcamera_clear_buffers(impl, port); + spa_libcamera_clear_buffers(port); freeBuffers(impl, port); port->current_format.reset(); } @@ -1947,7 +1942,7 @@ int impl_node_port_use_buffers(void *object, if (port->n_buffers) { spa_libcamera_stream_off(impl); - if ((res = spa_libcamera_clear_buffers(impl, port)) < 0) + if ((res = spa_libcamera_clear_buffers(port)) < 0) return res; } if (n_buffers > 0 && !port->current_format)