diff options
author | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-10-25 11:16:37 +0200 |
---|---|---|
committer | Frantisek Sumsal <frantisek@sumsal.cz> | 2023-10-25 11:16:37 +0200 |
commit | b3bfb95178a8dce6bf3db9337bb0d3901485883b (patch) | |
tree | bd4c0b3beba4c35753a2781e8b1d76e0357442ff /coccinelle | |
parent | execute: log about failures when opening a terminal to reset (diff) | |
download | systemd-b3bfb95178a8dce6bf3db9337bb0d3901485883b.tar.xz systemd-b3bfb95178a8dce6bf3db9337bb0d3901485883b.zip |
coccinelle: don't run iovec-make on iovec_done{,_erase}
As the result is a bit funky (but still valid), i.e.:
static inline void iovec_done_erase(struct iovec *iovec) {
assert(iovec);
- iovec->iov_base = erase_and_free(iovec->iov_base);
- iovec->iov_len = 0;
+ *iovec = IOVEC_MAKE(erase_and_free(iovec->iov_base), 0);
}
Diffstat (limited to 'coccinelle')
-rw-r--r-- | coccinelle/iovec-make.cocci | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/coccinelle/iovec-make.cocci b/coccinelle/iovec-make.cocci index 79116882fc..bbbf4a2b00 100644 --- a/coccinelle/iovec-make.cocci +++ b/coccinelle/iovec-make.cocci @@ -13,9 +13,13 @@ expression x, p, l; - x.iov_len = l; + x = IOVEC_MAKE(p, l); @@ +/* Don't run this transformation on iovec_done() and iovec_done_erase(), + * since the result, albeit correct, is a bit funky. */ + position pos : script:python() { pos[0].current_element != "iovec_done" and + pos[0].current_element != "iovec_done_erase" }; expression x, p, l; @@ -- x->iov_base = p; +- x->iov_base@pos = p; - x->iov_len = l; + *x = IOVEC_MAKE(p, l); @@ |