diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-06-05 15:12:29 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2020-06-22 16:32:37 +0200 |
commit | de7fef4b6eb4f5ca1cd21a309c37d0a74d4d305b (patch) | |
tree | ead57ab4a03ef723497b65d0efd79ea8973aaaed /coccinelle | |
parent | 0f9ccd95525c9869b6a23b71f6b7dbb2a7038674 (diff) | |
download | systemd-de7fef4b6eb4f5ca1cd21a309c37d0a74d4d305b.tar.gz |
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.
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/set_ensure_put.cocci | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/coccinelle/set_ensure_put.cocci b/coccinelle/set_ensure_put.cocci new file mode 100644 index 0000000000..92d7970ade --- /dev/null +++ b/coccinelle/set_ensure_put.cocci @@ -0,0 +1,18 @@ +@@ +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); |