From: Thomas Adam <thomas@xteddy.org>
To: Julia Lawall <julia.lawall@inria.fr>
Cc: Coccinelle <cocci@systeme.lip6.fr>
Subject: Re: [Cocci] Replacing a struct member with a function call
Date: Thu, 18 Mar 2021 18:19:18 +0000 [thread overview]
Message-ID: <CAOhcEPbxcy7eZ_kXTWiC_u7EX_VPo56xKTu9g6nS1OwDLp+4zQ@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.2.22.394.2103160820280.2872@hadrien>
Hi all,
Thanks for your help. This is now resolved!
Kindly,
Thomas
On Tue, 16 Mar 2021 at 07:20, Julia Lawall <julia.lawall@inria.fr> wrote:
>
>
>
> On Mon, 15 Mar 2021, Mansour Moufid wrote:
>
> > On Sun, Mar 14, 2021, 20:43 Thomas Adam <thomas@xteddy.org> wrote:
> > Hello,
> >
> > I can see I was as clear as mud with my explanation -- apologies
> > for
> > that, so let me try again.
> >
> > In my original example:
> >
> > struct monitor {
> > struct {
> > int width;
> > int height
> > } virtual;
> > };
> >
> > ... the members width and height aren't required any more, as
> > they're
> > actually computable generically, and don't belong in that
> > struct.
> > Instead, I have separate functions which can provide those
> > values.
> >
> > So where I have in code, statements such as:
> >
> > struct monitor *m = this_monitor();
> > int foo = m->virutal.width;
> >
> > I want to be able to substitute "m->virtual.width" with a
> > function
> > call "get_width()" -- which does not involve "struct monitor" at
> > all.
> > Indeed, the semantic patch I'm trying to apply now looks like
> > this:
> >
> > @@
> > struct monitor *m;
> > @@
> >
> > - m->virtual.width;
> > + get_width();
> >
> > ... and although spatch doesn't tell me of any errors, when I
> > run it
> > over my codebase, no modifications are made. So clearly I'm
> > still
> > doing something wrong.
> >
> >
> > Remove the semi-colons. ;)
>
> Good catch :)
>
> julia
_______________________________________________
Cocci mailing list
Cocci@systeme.lip6.fr
https://systeme.lip6.fr/mailman/listinfo/cocci
prev parent reply other threads:[~2021-03-18 18:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-14 0:55 [Cocci] Replacing a struct member with a function call Thomas Adam
2021-03-14 6:10 ` Wolfram Sang
2021-03-14 9:16 ` Julia Lawall
2021-03-15 0:43 ` Thomas Adam
2021-03-15 6:38 ` Julia Lawall
2021-03-16 2:48 ` Mansour Moufid
2021-03-16 7:20 ` Julia Lawall
2021-03-18 18:19 ` Thomas Adam [this message]
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=CAOhcEPbxcy7eZ_kXTWiC_u7EX_VPo56xKTu9g6nS1OwDLp+4zQ@mail.gmail.com \
--to=thomas@xteddy.org \
--cc=cocci@systeme.lip6.fr \
--cc=julia.lawall@inria.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).