diff mbox series

[2/2] v4l-utils: clang-tidy: use auto with iterators

Message ID 20240703011340.10094-2-rosenp@gmail.com (mailing list archive)
State New
Headers show
Series [1/2] v4l-utils: clang-tidy: convert to for range loop | expand

Commit Message

Rosen Penev July 3, 2024, 1:13 a.m. UTC
Found with: modernize-use-auto

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 utils/cec-follower/cec-processing.cpp        | 2 +-
 utils/v4l2-compliance/v4l2-test-controls.cpp | 1 -
 utils/v4l2-tracer/retrace-helper.cpp         | 3 +--
 utils/v4l2-tracer/trace-helper.cpp           | 6 ++----
 4 files changed, 4 insertions(+), 8 deletions(-)
diff mbox series

Patch

diff --git a/utils/cec-follower/cec-processing.cpp b/utils/cec-follower/cec-processing.cpp
index 14ee211b..9d68fa06 100644
--- a/utils/cec-follower/cec-processing.cpp
+++ b/utils/cec-follower/cec-processing.cpp
@@ -1013,7 +1013,7 @@  static void poll_remote_devs(struct node *node, unsigned me)
 
 static void update_programmed_timers(struct node *node)
 {
-	std::set<struct Timer>::iterator it = programmed_timers.begin();
+	auto it = programmed_timers.begin();
 	/* Use the current minute because timers do not have second precision. */
 	time_t current_minute = time(nullptr) / 60;
 	time_t timer_start_minute = it->start_time / 60;
diff --git a/utils/v4l2-compliance/v4l2-test-controls.cpp b/utils/v4l2-compliance/v4l2-test-controls.cpp
index e29174ec..e87a1af9 100644
--- a/utils/v4l2-compliance/v4l2-test-controls.cpp
+++ b/utils/v4l2-compliance/v4l2-test-controls.cpp
@@ -845,7 +845,6 @@  static int checkVividControls(struct node *node,
 
 int testExtendedControls(struct node *node)
 {
-	qctrl_map::iterator iter;
 	struct v4l2_ext_controls ctrls;
 	std::vector<struct v4l2_ext_control> total_vec;
 	std::vector<struct v4l2_ext_control> class_vec;
diff --git a/utils/v4l2-tracer/retrace-helper.cpp b/utils/v4l2-tracer/retrace-helper.cpp
index 8efc00f8..ea96f8ff 100644
--- a/utils/v4l2-tracer/retrace-helper.cpp
+++ b/utils/v4l2-tracer/retrace-helper.cpp
@@ -92,8 +92,7 @@  void add_fd(int fd_trace, int fd_retrace)
 int get_fd_retrace_from_fd_trace(int fd_trace)
 {
 	int fd_retrace = -1;
-	std::unordered_map<int, int>::const_iterator it;
-	it = ctx_retrace.retrace_fds.find(fd_trace);
+	auto it = ctx_retrace.retrace_fds.find(fd_trace);
 	if (it != ctx_retrace.retrace_fds.end())
 		fd_retrace = it->second;
 	return fd_retrace;
diff --git a/utils/v4l2-tracer/trace-helper.cpp b/utils/v4l2-tracer/trace-helper.cpp
index 3eee20c2..9e5747a2 100644
--- a/utils/v4l2-tracer/trace-helper.cpp
+++ b/utils/v4l2-tracer/trace-helper.cpp
@@ -27,8 +27,7 @@  void add_device(int fd, std::string path)
 std::string get_device(int fd)
 {
 	std::string path;
-	std::unordered_map<int, std::string>::const_iterator it;
-	it = ctx_trace.devices.find(fd);
+	auto it = ctx_trace.devices.find(fd);
 	if (it != ctx_trace.devices.end())
 		path = it->second;
 	return path;
@@ -58,8 +57,7 @@  void set_decode_order(long decode_order)
 {
 	debug_line_info("\n\t%ld", decode_order);
 
-	std::list<long>::iterator it;
-	it = find(ctx_trace.decode_order.begin(), ctx_trace.decode_order.end(), decode_order);
+	auto it = find(ctx_trace.decode_order.begin(), ctx_trace.decode_order.end(), decode_order);
 	if (it == ctx_trace.decode_order.end())
 		ctx_trace.decode_order.push_front(decode_order);