use CALLOC_ARRAY
Add and apply a semantic patch for converting code that open-codes CALLOC_ARRAY to use it instead. It shortens the code and infers the element size automatically. 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
f1121499e6
commit
ca56dadb4b
@ -476,7 +476,7 @@ static void collect_changes_cb(struct diff_queue_struct *q,
|
||||
|
||||
add_file_item(s->files, name);
|
||||
|
||||
entry = xcalloc(sizeof(*entry), 1);
|
||||
CALLOC_ARRAY(entry, 1);
|
||||
hashmap_entry_init(&entry->ent, hash);
|
||||
entry->name = s->files->items[s->files->nr - 1].string;
|
||||
entry->item = s->files->items[s->files->nr - 1].util;
|
||||
|
||||
Reference in New Issue
Block a user