From 493f198e94f84e6453573f24f10a2a30edb3c9c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Barnab=C3=A1s=20P=C5=91cze?= Date: Tue, 26 Nov 2024 18:03:10 +0000 Subject: treewide: Avoid some copies in range-based for loops MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Most of these have been found by the `performance-for-range-copy` check of `clang-tidy`. Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Signed-off-by: Laurent Pinchart --- test/gstreamer/gstreamer_device_provider_test.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'test/gstreamer') diff --git a/test/gstreamer/gstreamer_device_provider_test.cpp b/test/gstreamer/gstreamer_device_provider_test.cpp index 8b8e7cba..521c60b8 100644 --- a/test/gstreamer/gstreamer_device_provider_test.cpp +++ b/test/gstreamer/gstreamer_device_provider_test.cpp @@ -52,19 +52,12 @@ protected: for (l = devices; l != NULL; l = g_list_next(l)) { GstDevice *device = GST_DEVICE(l->data); g_autofree gchar *gst_name; - bool matched = false; g_autoptr(GstElement) element = gst_device_create_element(device, NULL); g_object_get(element, "camera-name", &gst_name, NULL); - for (auto name : cameraNames) { - if (strcmp(name.c_str(), gst_name) == 0) { - matched = true; - break; - } - } - - if (!matched) + if (std::find(cameraNames.begin(), cameraNames.end(), gst_name) == + cameraNames.end()) return TestFail; } -- cgit v1.2.1