From: lars@metafoo.de (Lars-Peter Clausen)
To: cocci@systeme.lip6.fr
Subject: [Cocci] Help with SMPL
Date: Wed, 26 Sep 2012 17:27:30 +0200 [thread overview]
Message-ID: <50631EE2.4030208@metafoo.de> (raw)
In-Reply-To: <CA+MoWDrEmG1NowmRpB3S_4MnnxOk1q9=fo-tkCmL3PLrgn5K0w@mail.gmail.com>
On 09/26/2012 04:36 PM, Peter Senna Tschudin wrote:
> Dear List,
>
> I'm trying to make a semantic patch for the case described on the patch:
> http://www.mail-archive.com/linux-media at vger.kernel.org/msg52660.html
>
> Some relevant code snippets:
>
> http://lxr.free-electrons.com/source/drivers/media/video/em28xx/em28xx.h#L482
> -- // --
> struct em28xx {
> ...
> int model; /* index in the device_data struct */
> ...
> struct em28xx_board board;
> ...
> }
> -- // --
>
> http://lxr.free-electrons.com/source/drivers/media/video/em28xx/em28xx.h#L690
> -- // --
> ...
> extern struct em28xx_board em28xx_boards[];
> ...
> -- // --
>
> I'm trying the semantic patch:
> @@
> type T;
> expression to,from,flag;
> @@
> - memcpy((T)&to,(T)&from,flag);
> + to = from;
>
> But it is not working. How can I specify "to" and "from" for match
> cases like this?
Do you want the types of "to" and "from" to match? Then you could do
something like:
@@
type T;
T to;
T from;
expression size;
@@
-memcpy(&to, &from, size);
+to = from;
- Lars
next prev parent reply other threads:[~2012-09-26 15:27 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 14:36 [Cocci] Help with SMPL Peter Senna Tschudin
2012-09-26 15:27 ` Lars-Peter Clausen [this message]
2012-09-26 15:40 ` Ezequiel Garcia
2012-09-26 16:01 ` Lars-Peter Clausen
2012-09-26 16:02 ` Ezequiel Garcia
2012-09-26 16:06 ` Peter Senna Tschudin
2012-09-26 15:57 ` Peter Senna Tschudin
[not found] <CA+MoWDpBor-e+69ioxPH-kWcdnd8iYE3E9aXjC79dNO+_COxeg@mail.gmail.com>
[not found] ` <501BEA35.5030008@redhat.com>
[not found] ` <501BFA96.6080803@metafoo.de>
[not found] ` <alpine.DEB.2.02.1208031832490.2827@hadrien>
[not found] ` <501C0878.1010906@metafoo.de>
[not found] ` <alpine.DEB.2.02.1208032309470.1928@localhost6.localdomain6>
2012-09-27 15:29 ` [Cocci] Help with SmPL Peter Senna Tschudin
2012-09-27 16:30 ` Håkon Løvdal
2012-09-27 17:54 ` Håkon Løvdal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=50631EE2.4030208@metafoo.de \
--to=lars@metafoo.de \
--cc=cocci@systeme.lip6.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.