From 5304ba7e560fc9b5f13fd5657e370d726714673b Mon Sep 17 00:00:00 2001 From: David Lamparter Date: Fri, 9 Dec 2016 17:50:01 +0100 Subject: *: kill useless if(...) after VTY_DECLVAR_CONTEXT VTY_DECLVAR_CONTEXT already contains a NULL check, vty warning message and return statement. These are not needed. Signed-off-by: David Lamparter --- tools/vty_check.cocci | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tools/vty_check.cocci (limited to 'tools/vty_check.cocci') diff --git a/tools/vty_check.cocci b/tools/vty_check.cocci new file mode 100644 index 000000000..7e5fcc405 --- /dev/null +++ b/tools/vty_check.cocci @@ -0,0 +1,22 @@ +/* + * VTY_DECLVAR_CONTEXT contains a built-in "if (!var) return;" + */ +@@ +identifier var, typ; +statement S; +@@ + + { + ... + \( + VTY_DECLVAR_CONTEXT(typ, var); + \| + VTY_DECLVAR_CONTEXT_SUB(typ, var); + \) + ... +- if ( +- \( !var \| var == NULL \) +- ) +- S + ... + } -- cgit v1.2.3