c - Coccinelle output -


i beginner in coccinelle , try run first example.

currently i'am following steps of this article

  1. i created c file
  2. i created coccinelle script
  3. i run using

    $ spatch -sp_file test.cocci test.c 

in terminal got expected result mentioned in article

--- test.c +++ /tmp/cocci-output-17416-b5450d-test.c @@ -7,7 +7,7 @@ main(int argc, char *argv[])          char *buf;           /* allocate memory */ -        buf = alloca(bytes); +        buf = malloc(bytes);           return 0;  } 

however c file didn't change expected.

can body tell me can changes made script?

you can use --in-place option.

so following should want.

$ spatch -sp_file test.cocci test.c --in-place


Comments