Updating all call sites of a function?
----- Ursprüngliche Mail -----
Quoted 22 lines
Von: "richard" <[email protected]>
An: "cocci" <[email protected]>
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?
Quoted 6 lines
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
Quoted 38 lines · Richard Weinberger
----- Ursprüngliche Mail -----
Quoted 22 lines
Von: "richard" <[email protected]>
An: "cocci" <[email protected]>
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?Quoted 6 lines
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)
Quoted 1 line
My fist version always had a trailing ";", so they matched only trivial callers...
Exactly.
julia
Quoted 7 lines
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