241b5d3ebe
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>
11 lines
96 B
Plaintext
11 lines
96 B
Plaintext
@@
|
|
type T;
|
|
T *ptr;
|
|
expression n;
|
|
@@
|
|
xcalloc(
|
|
+ n,
|
|
\( sizeof(T) \| sizeof(*ptr) \)
|
|
- , n
|
|
)
|