fix xcalloc() argument order
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>
This commit is contained in:

committed by
Junio C Hamano

parent
59ec22464f
commit
241b5d3ebe
@ -93,7 +93,7 @@ static int read_patches(const char *range, struct string_list *list,
|
||||
string_list_append(list, buf.buf)->util = util;
|
||||
strbuf_reset(&buf);
|
||||
}
|
||||
util = xcalloc(sizeof(*util), 1);
|
||||
util = xcalloc(1, sizeof(*util));
|
||||
if (get_oid(p, &util->oid)) {
|
||||
error(_("could not parse commit '%s'"), p);
|
||||
free(util);
|
||||
|
Reference in New Issue
Block a user