1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00
systemd/coccinelle/set_ensure_put.cocci
Zbigniew Jędrzejewski-Szmek de7fef4b6e tree-wide: use set_ensure_put()
Patch contains a coccinelle script, but it only works in some cases. Many
parts were converted by hand.

Note: I did not fix errors in return value handing. This will be done separate
to keep the patch comprehensible. No functional change is intended in this
patch.
2020-06-22 16:32:37 +02:00

19 lines
329 B
Plaintext

@@
local idexpression r;
expression p, k, x;
@@
- r = set_ensure_allocated(&p, k);
- if (r < 0)
- return ...;
- r = set_put(p, x);
+ r = set_ensure_put(&p, k, x);
@@
local idexpression r;
expression p, k, x;
@@
- r = set_ensure_allocated(p, k);
- if (r < 0)
- return ...;
- r = set_put(*p, x);
+ r = set_ensure_put(p, k, x);