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>
This commit is contained in:
Barnabás Pőcze 2024-11-26 18:03:10 +00:00 committed by Laurent Pinchart
parent 4e557e544b
commit 493f198e94
5 changed files with 8 additions and 14 deletions

View file

@ -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;
}