]> git.ipfire.org Git - thirdparty/systemd.git/blob - coccinelle/iovec-make.cocci
test: make coverage runs happy with capsule@.service
[thirdparty/systemd.git] / coccinelle / iovec-make.cocci
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 @@
3 expression x, y, p, l;
4 @@
5 - x[y].iov_base = p;
6 - x[y].iov_len = l;
7 - y++;
8 + x[y++] = IOVEC_MAKE(p, l);
9 @@
10 expression x, p, l;
11 @@
12 - x.iov_base = p;
13 - x.iov_len = l;
14 + x = IOVEC_MAKE(p, l);
15 @@
16 /* Don't run this transformation on iovec_done() and iovec_done_erase(),
17 * since the result, albeit correct, is a bit funky. */
18 position pos : script:python() { pos[0].current_element != "iovec_done" and
19 pos[0].current_element != "iovec_done_erase" };
20 expression x, p, l;
21 @@
22 - x->iov_base@pos = p;
23 - x->iov_len = l;
24 + *x = IOVEC_MAKE(p, l);
25 @@
26 expression s;
27 @@
28 - IOVEC_MAKE(s, strlen(s));
29 + IOVEC_MAKE_STRING(s);
30 @@
31 expression x, y, z;
32 @@
33 - x = (struct iovec) { .iov_base = y, .iov_len = z };
34 + x = IOVEC_MAKE(y, z);