summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBarnabás Pőcze <pobrn@protonmail.com>2024-11-26 18:03:10 +0000
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2024-11-27 16:20:51 +0200
commit493f198e94f84e6453573f24f10a2a30edb3c9c0 (patch)
tree558edb6dc64455d7cdbdb9bedc98abb2ba6bf7c0 /test
parent4e557e544bce6da8c00c73de2dfe76403bbf8c00 (diff)
treewide: Avoid some copies in range-based for loops
Most of these have been found by the `performance-for-range-copy` check of `clang-tidy`. Signed-off-by: Barnabás Pőcze <pobrn@protonmail.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'test')
-rw-r--r--test/gstreamer/gstreamer_device_provider_test.cpp11
1 files changed, 2 insertions, 9 deletions
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;
}