Linux-Media Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] clang-tidy: use using instead of typedef
@ 2021-04-20 21:10 Rosen Penev
  0 siblings, 0 replies; only message in thread
From: Rosen Penev @ 2021-04-20 21:10 UTC (permalink / raw)
  To: linux-media

Found with modernize-use-using

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 utils/cec-ctl/cec-ctl.cpp                   | 2 +-
 utils/common/media-info.cpp                 | 4 ++--
 utils/common/v4l2-info.cpp                  | 4 ++--
 utils/qv4l2/qv4l2.h                         | 8 ++++----
 utils/rds-ctl/rds-ctl.cpp                   | 2 +-
 utils/v4l2-compliance/v4l2-compliance.h     | 8 ++++----
 utils/v4l2-compliance/v4l2-test-buffers.cpp | 2 +-
 utils/v4l2-compliance/v4l2-test-media.cpp   | 2 +-
 utils/v4l2-ctl/v4l2-ctl-common.cpp          | 2 +-
 utils/v4l2-ctl/v4l2-ctl.h                   | 4 ++--
 10 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/utils/cec-ctl/cec-ctl.cpp b/utils/cec-ctl/cec-ctl.cpp
index a9d4d5c02..c17265a5c 100644
--- a/utils/cec-ctl/cec-ctl.cpp
+++ b/utils/cec-ctl/cec-ctl.cpp
@@ -148,7 +148,7 @@ struct node {
 
 bool verbose;
 
-typedef std::vector<cec_msg> msg_vec;
+using msg_vec = std::vector<cec_msg>;
 
 static struct option long_options[] = {
 	{ "device", required_argument, nullptr, OptSetDevice },
diff --git a/utils/common/media-info.cpp b/utils/common/media-info.cpp
index 29a43fb35..9c74b1477 100644
--- a/utils/common/media-info.cpp
+++ b/utils/common/media-info.cpp
@@ -118,10 +118,10 @@ std::string mi_media_get_device(__u32 major, __u32 minor)
 	return "";
 }
 
-typedef struct {
+struct flag_def {
 	unsigned flag;
 	const char *str;
-} flag_def;
+};
 
 static std::string flags2s(unsigned val, const flag_def *def)
 {
diff --git a/utils/common/v4l2-info.cpp b/utils/common/v4l2-info.cpp
index fe4defd9c..cb3cb91f7 100644
--- a/utils/common/v4l2-info.cpp
+++ b/utils/common/v4l2-info.cpp
@@ -16,10 +16,10 @@ static std::string num2s(unsigned num, bool is_hex = true)
 	return buf;
 }
 
-typedef struct {
+struct flag_def {
 	unsigned flag;
 	const char *str;
-} flag_def;
+};
 
 static std::string flags2s(unsigned val, const flag_def *def)
 {
diff --git a/utils/qv4l2/qv4l2.h b/utils/qv4l2/qv4l2.h
index a585ac35c..aaba74d0e 100644
--- a/utils/qv4l2/qv4l2.h
+++ b/utils/qv4l2/qv4l2.h
@@ -51,10 +51,10 @@ class VbiTab;
 class QCloseEvent;
 class CaptureWin;
 
-typedef std::vector<unsigned> ClassIDVec;
-typedef std::map<unsigned, ClassIDVec> ClassMap;
-typedef std::map<unsigned, struct v4l2_query_ext_ctrl> CtrlMap;
-typedef std::map<unsigned, QWidget *> WidgetMap;
+using ClassIDVec = std::vector<unsigned>;
+using ClassMap = std::map<unsigned, ClassIDVec>;
+using CtrlMap = std::map<unsigned, v4l2_query_ext_ctrl>;
+using WidgetMap = std::map<unsigned, QWidget *>;
 
 enum {
 	CTRL_UPDATE_ON_CHANGE = 0x10,
diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 994fc9c4d..e27182821 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -29,7 +29,7 @@
 
 #define ARRAY_SIZE(arr) ((int)(sizeof(arr) / sizeof((arr)[0])))
 
-typedef std::vector<std::string> dev_vec;
+using dev_vec = std::vector<std::string>;
 using dev_map = std::map<std::string, std::string>;
 
 /* Short option list
diff --git a/utils/v4l2-compliance/v4l2-compliance.h b/utils/v4l2-compliance/v4l2-compliance.h
index 4d5c3a5c0..d13dd2e2d 100644
--- a/utils/v4l2-compliance/v4l2-compliance.h
+++ b/utils/v4l2-compliance/v4l2-compliance.h
@@ -78,10 +78,10 @@ struct test_query_ext_ctrl: v4l2_query_ext_ctrl {
 	__u64 menu_mask;
 };
 
-typedef std::map<__u32, struct test_query_ext_ctrl> qctrl_map;
-typedef std::map<__u32, __u32> pixfmt_map;
-typedef std::set<__u64> frmsizes_set;
-typedef std::map<__u32, unsigned> frmsizes_count_map;
+using qctrl_map = std::map<__u32, test_query_ext_ctrl>;
+using pixfmt_map = std::map<__u32, __u32>;
+using frmsizes_set = std::set<__u64>;
+using frmsizes_count_map = std::map<__u32, unsigned>;
 
 struct base_node;
 
diff --git a/utils/v4l2-compliance/v4l2-test-buffers.cpp b/utils/v4l2-compliance/v4l2-test-buffers.cpp
index 131fedc67..bc5958c2c 100644
--- a/utils/v4l2-compliance/v4l2-test-buffers.cpp
+++ b/utils/v4l2-compliance/v4l2-test-buffers.cpp
@@ -93,7 +93,7 @@ enum QueryBufMode {
 	Dequeued
 };
 
-typedef std::map<struct timeval, struct v4l2_buffer> buf_info_map;
+using buf_info_map = std::map<struct timeval, struct v4l2_buffer>;
 static buf_info_map buffer_info;
 
 #define FILE_HDR_ID			v4l2_fourcc('V', 'h', 'd', 'r')
diff --git a/utils/v4l2-compliance/v4l2-test-media.cpp b/utils/v4l2-compliance/v4l2-test-media.cpp
index d7a83b0cd..ef2982c04 100644
--- a/utils/v4l2-compliance/v4l2-test-media.cpp
+++ b/utils/v4l2-compliance/v4l2-test-media.cpp
@@ -73,7 +73,7 @@ static int checkDevice(__u32 major, __u32 minor, bool iface, __u32 id)
 	return 0;
 }
 
-typedef std::set<__u32> id_set;
+using id_set = std::set<__u32>;
 
 static media_v2_topology topology;
 static media_v2_entity *v2_ents;
diff --git a/utils/v4l2-ctl/v4l2-ctl-common.cpp b/utils/v4l2-ctl/v4l2-ctl-common.cpp
index 15b68b5ee..17ad488dd 100644
--- a/utils/v4l2-ctl/v4l2-ctl-common.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-common.cpp
@@ -22,7 +22,7 @@ struct ctrl_subset {
 	unsigned size[V4L2_CTRL_MAX_DIMS];
 };
 
-typedef std::map<unsigned, std::vector<struct v4l2_ext_control> > class2ctrls_map;
+using class2ctrls_map = std::map<unsigned int, std::vector<struct v4l2_ext_control> >;
 
 using ctrl_qmap = std::map<std::string, struct v4l2_query_ext_ctrl>;
 static ctrl_qmap ctrl_str2q;
diff --git a/utils/v4l2-ctl/v4l2-ctl.h b/utils/v4l2-ctl/v4l2-ctl.h
index f9bad45cc..7518ac6f5 100644
--- a/utils/v4l2-ctl/v4l2-ctl.h
+++ b/utils/v4l2-ctl/v4l2-ctl.h
@@ -277,10 +277,10 @@ extern __u32 vidcap_buftype;
 extern __u32 vidout_buftype;
 extern int verbose;
 
-typedef struct {
+struct flag_def {
 	unsigned flag;
 	const char *str;
-} flag_def;
+};
 
 /* fmts specified */
 #define FmtWidth		(1L<<0)
-- 
2.30.2


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, back to index

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-20 21:10 [PATCH] clang-tidy: use using instead of typedef Rosen Penev

Linux-Media Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-media/0 linux-media/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-media linux-media/ https://lore.kernel.org/linux-media \
		linux-media@vger.kernel.org
	public-inbox-index linux-media

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-media


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git