summaryrefslogtreecommitdiffstats
path: root/tools/coccinelle/vty_check.cocci
blob: 7e5fcc405b62925996045f480ea087d25b3e0903 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
    ...
  }