Skip to contentSkip to conversation

src: Remove unnecessary cast on void pointer

PATCH New Harsha Sharma 1 participant 1 message Oct 13, 2017 netfilter

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 src: Remove unnecessary cast on void pointer

Done with following coccinelle patch

@r@
expression x;
void* e;
type T;
identifier f;
@@
(
*((T *)e)
|
((T *)x)[...]
|
((T*)x)->f
|

- (T*)
e
)

---
 src/netlink.c | 2 +-
 src/tcpopt.c  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
src/netlink.c +1 -1
index d5d410a..3a7ae62 100644
@@ -2941,7 +2941,7 @@ static int netlink_events_cb(const struct nlmsghdr *nlh, void *data)
 {
 	int ret = MNL_CB_OK;
 	uint16_t type = NFNL_MSG_TYPE(nlh->nlmsg_type);
-	struct netlink_mon_handler *monh = (struct netlink_mon_handler *)data;
+	struct netlink_mon_handler *monh = data;
 
 	netlink_events_debug(type, monh->debug_mask);
 	netlink_events_cache_update(monh, nlh, type);
src/tcpopt.c +1 -1
index 7c6c255..c37c9d5 100644
@@ -86,7 +86,7 @@ static const struct exthdr_desc tcpopt_timestamp = {
 };
 #undef PHT
 
-#define TCPOPT_OBSOLETE ((struct exthdr_desc *)NULL)
+#define TCPOPT_OBSOLETE (NULL)
 #define TCPOPT_ECHO 6
 #define TCPOPT_ECHO_REPLY 7
 static const struct exthdr_desc *tcpopt_protocols[] = {
Signature · 1 line
2.11.0