Re: [cocci] [RFC] Increasing usage of direct pointer assignments from memcpy() calls with SmPL?
From: Markus Elfring
Date: Thu Oct 30 2025 - 06:19:13 EST
…> I think you would get a more satisfactory result by just removing all of
> the code and adding it back. Then Coccinelle would take charge of laying
> out the whole thing.
…
See also once more:
>> Another SmPL script example might become helpful.
>>
>> @replacement2@
>> expression object, size, source, target;
>> @@
>> target =
>> - object; memcpy(target, source, size)
>> + memcpy(object, source, size)
>> ;
>>
>>
>> Markus_Elfring@Sonne:…/Projekte/Linux/next-analyses> time /usr/bin/spatch --max-width 100 --no-loops …/Projekte/Coccinelle/janitor/use_memcpy_assignment2.cocci arch/arm64/kvm/arm.c
…>> real 0m0,626s
>> user 0m0,588s
>> sys 0m0,037s
Regards,
Markus