coccinelle: automatically switch some uses of memcpy() → mempcpy()

Inspired by #22520, let's add a coccinelle script that converts this
automatically.
This commit is contained in:
Lennart Poettering
2022-02-16 10:52:51 +01:00
parent bde335f21f
commit 96ca229517
3 changed files with 18 additions and 9 deletions

13
coccinelle/mempcpy.cocci Normal file
View File

@@ -0,0 +1,13 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
@@
expression x, y, z;
@@
- memcpy(x, y, z);
- x += z;
+ x = mempcpy(x, y, z);
@@
expression x, y, z;
@@
- memcpy_safe(x, y, z);
- x += z;
+ x = mempcpy_safe(x, y, z);