summaryrefslogtreecommitdiff
path: root/contrib/coccinelle/xcalloc.cocci
AgeCommit message (Collapse)AuthorFilesLines
2021-03-08fix xcalloc() argument orderLibravatar René Scharfe1-0/+10
Pass the number of elements first and ther size second, as expected by xcalloc(). Provide a semantic patch, which was actually used to generate the rest of this patch. The semantic patch would generate flip-flop diffs if both arguments are sizeofs. We don't have such a case, and it's hard to imagine the usefulness of such an allocation. If it ever occurs then we could deal with it by duplicating the rule in the semantic patch to make it cancel itself out, or we could change the code to use CALLOC_ARRAY. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>