On Tue, 15 Aug 2017, SF Markus Elfring wrote:

> > The source code analysis results look promising by this command.
>
> I have just noticed that an other source file points details out for further
> development considerations around the mentioned functionality from the
> Coccinelle software.
>
> elfring@Sonne:~/Projekte/Linux/next-patched> git checkout next-20170803 && 
> spatch.opt ~/Projekte/Coccinelle/janitor/show_same_statements1.cocci 
> sound/pci/rme9652/hdspm.c
> …
>      (ONCE) already tagged but only removed, so safe
> diff =
> …
> @@ -6497,9 +6497,6 @@ static int snd_hdspm_create_alsa_devices
>       i = 0;
>       while (i < hdspm->midiPorts) {
>               err = snd_hdspm_create_midi(card, hdspm, i);
> -             if (err < 0) {
> -                     return err;
> -             }
>               i++;
>       }
>
> @@ -6955,10 +6952,6 @@ static int snd_hdspm_probe(struct pci_de
>       hdspm->pci = pci;
>
>       err = snd_hdspm_create(card, hdspm);
> -     if (err < 0) {
> -             snd_card_free(card);
> -             return err;
> -     }
>
>       if (hdspm->io_type != MADIface) {
>               snprintf(card->shortname, sizeof(card->shortname), "%s_%x",
> …
>
>
> Now I am looking for a way to express the constraint that the statement list
> metavariable should match only source code with two statements at least.
> Can the search for duplicated source code be improved by the means of the
> semantic patch language?

For two statements at least you could do:

(
{
s1
s2
...
}
&
{
sl
}
)

julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci

Reply via email to