cocci: avoid normalization rules for memcpy
commitf53156f2ee9b76328641b714d4dd847881711951
authorRené Scharfe <l.s.r@web.de>
Sun, 10 Jul 2022 10:05:51 +0000 (10 12:05 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 10 Jul 2022 21:52:05 +0000 (10 14:52 -0700)
tree9668021a0d3f2312b6b6f551b8a224611b87ee31
parentdc8c8deaa6b5847733bd7df011a4c7b7d1a64e0a
cocci: avoid normalization rules for memcpy

Some of the rules for using COPY_ARRAY instead of memcpy with sizeof are
intended to reduce the number of sizeof variants to deal with.  They can
have unintended side effects if only they match, but not the one for the
COPY_ARRAY conversion at the end.

Avoid these side effects by instead using a self-contained rule for each
combination of array and pointer for source and destination which lists
all sizeof variants inline.

This lets "make contrib/coccinelle/array.cocci.patch" take 15% longer on
my machine, but gives peace of mind that no incomplete transformation
will be generated.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/coccinelle/array.cocci