On Tue, 25 Feb 2014, SF Markus Elfring wrote:
> > I'm not sure to understand your goal.
>
> I get an interesting result for example if I try the following source code
> search pattern out. Do you find it useful?
>
> @Delete_unnecessary_checks@
> expression x;
> identifier release =~ "^(?x)
> (?:
> (?:kz?|slob_)free
> |
> (?:
> abc
> | xyz
> )
> )$";
> @@
> -if (x)
> release(...,x,...);
>
> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --sp-file
> delete_unnecessary_checks1.cocci /usr/src/linux-stable/fs/btrfs/inode.c
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> HANDLING: /usr/src/linux-stable/fs/btrfs/inode.c
> diff =
> --- /usr/src/linux-stable/fs/btrfs/inode.c
> +++ /tmp/cocci-output-3740-5d95d8-inode.c
> @@ -5137,8 +5137,7 @@ static int btrfs_dentry_delete(const str
>
> static void btrfs_dentry_release(struct dentry *dentry)
> {
> - if (dentry->d_fsdata)
> - kfree(dentry->d_fsdata);
> + kfree(dentry->d_fsdata);
> }
>
>
> > If you remove the NULL test, you could drastically change the behavior
> > of the program.
>
> But it seems that I stumble on a software debug challenge after I replaced the
> dummy alternation in the regular expression above by the real list of 5142
> function names which were found by the other discussed pattern.
>
> elfring@Sonne:~/Projekte/Coccinelle/janitor> spatch --sp-file
> delete_unnecessary_checks2.cocci /usr/src/linux-stable/fs/btrfs/inode.c
> init_defs_builtins: /usr/local/share/coccinelle/standard.h
> Fatal error: exception Pcre.Error(_)
I don't think it is a good approach to do anything related to 5142
different functions at once. It would be better to pick a small set of
functions, and work on them carefully.
julia
_______________________________________________
Cocci mailing list
[email protected]
https://systeme.lip6.fr/mailman/listinfo/cocci