From: Richard Weinberger <richard@nod.at>
To: cocci <cocci@inria.fr>
Cc: Johannes Berg <johannes@sipsolutions.net>
Subject: Re: [cocci] Updating all call sites of a function?
Date: Tue, 21 Nov 2023 13:38:41 +0100 (CET) [thread overview]
Message-ID: <101903006.275.1700570321591.JavaMail.zimbra@nod.at> (raw)
In-Reply-To: <1735034650.197.1700567751120.JavaMail.zimbra@nod.at>
----- Ursprüngliche Mail -----
> Von: "richard" <richard@nod.at>
> An: "cocci" <cocci@inria.fr>
> Gesendet: Dienstag, 21. November 2023 12:55:51
> Betreff: Updating all call sites of a function?
> Hi!
>
> I would like to inquire about best practices for updating all call sites of a
> function.
> During refactoring, I changed the name and arguments of a function.
> For example:
>
> ubi_rmvol(libubi, dev, n);
>
> becomes:
>
> ubi_rmvol_wait(libubi, dev, n, 10);
>
> What approach do you suggest to catch all call sites, especially where the call
> is
> part of a non-trivial expression?
>
> e.g.
> ret = ubi_rmvol(libubi, dev, n);
>
> if (ubi_rmvol(libubi, dev, n)) { ...
>
> while(0 != ubi_rmvol(libubi, dev, n)) ...
Johannes pointed out on IRC that I think too complicated and gave me an example.
This does the trick:
@@
expression uctx, dev, n;
@@
- ubi_rmvol(uctx, dev, n)
+ ubi_rmvol_wait(uctx, dev, n, 10)
My fist version always had a trailing ";", so they matched only trivial callers...
Thanks,
//richard
next parent reply other threads:[~2023-11-27 19:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1735034650.197.1700567751120.JavaMail.zimbra@nod.at>
2023-11-21 12:38 ` Richard Weinberger [this message]
2023-11-27 19:57 ` [cocci] Updating all call sites of a function? Julia Lawall
2023-11-27 20:40 ` Markus Elfring
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=101903006.275.1700570321591.JavaMail.zimbra@nod.at \
--to=richard@nod.at \
--cc=cocci@inria.fr \
--cc=johannes@sipsolutions.net \
/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.