* Re: [cocci] Updating all call sites of a function?
[not found] <1735034650.197.1700567751120.JavaMail.zimbra@nod.at>
@ 2023-11-21 12:38 ` Richard Weinberger
2023-11-27 19:57 ` Julia Lawall
2023-11-27 20:40 ` Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: Richard Weinberger @ 2023-11-21 12:38 UTC (permalink / raw)
To: cocci; +Cc: Johannes Berg
----- 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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [cocci] Updating all call sites of a function?
2023-11-21 12:38 ` [cocci] Updating all call sites of a function? Richard Weinberger
@ 2023-11-27 19:57 ` Julia Lawall
2023-11-27 20:40 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Julia Lawall @ 2023-11-27 19:57 UTC (permalink / raw)
To: Richard Weinberger; +Cc: cocci, Johannes Berg
[-- Attachment #1: Type: text/plain, Size: 1142 bytes --]
On Tue, 21 Nov 2023, Richard Weinberger wrote:
> ----- 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...
Exactly.
julia
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [cocci] Updating all call sites of a function?
2023-11-21 12:38 ` [cocci] Updating all call sites of a function? Richard Weinberger
2023-11-27 19:57 ` Julia Lawall
@ 2023-11-27 20:40 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2023-11-27 20:40 UTC (permalink / raw)
To: Richard Weinberger, Johannes Berg, cocci
> 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)
How do you think about the possibility to apply the following SmPL script variant?
@adjustment@
@@
-ubi_rmvol
+ubi_rmvol_wait
(
...
+ , 10
)
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-11-27 20:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <1735034650.197.1700567751120.JavaMail.zimbra@nod.at>
2023-11-21 12:38 ` [cocci] Updating all call sites of a function? Richard Weinberger
2023-11-27 19:57 ` Julia Lawall
2023-11-27 20:40 ` Markus Elfring
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.