mirror of
https://github.com/systemd/systemd.git
synced 2024-11-26 19:53:45 +08:00
b3bfb95178
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); }
35 lines
796 B
Plaintext
35 lines
796 B
Plaintext
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
@@
|
|
expression x, y, p, l;
|
|
@@
|
|
- x[y].iov_base = p;
|
|
- x[y].iov_len = l;
|
|
- y++;
|
|
+ x[y++] = IOVEC_MAKE(p, l);
|
|
@@
|
|
expression x, p, l;
|
|
@@
|
|
- x.iov_base = p;
|
|
- 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@pos = p;
|
|
- x->iov_len = l;
|
|
+ *x = IOVEC_MAKE(p, l);
|
|
@@
|
|
expression s;
|
|
@@
|
|
- IOVEC_MAKE(s, strlen(s));
|
|
+ IOVEC_MAKE_STRING(s);
|
|
@@
|
|
expression x, y, z;
|
|
@@
|
|
- x = (struct iovec) { .iov_base = y, .iov_len = z };
|
|
+ x = IOVEC_MAKE(y, z);
|