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
@ -112,7 +112,7 @@ struct reflog_walk_info {
|
||||
|
||||
void init_reflog_walk(struct reflog_walk_info **info)
|
||||
{
|
||||
*info = xcalloc(1, sizeof(struct reflog_walk_info));
|
||||
CALLOC_ARRAY(*info, 1);
|
||||
(*info)->complete_reflogs.strdup_strings = 1;
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ int add_reflog_for_walk(struct reflog_walk_info *info,
|
||||
}
|
||||
free(branch);
|
||||
|
||||
commit_reflog = xcalloc(1, sizeof(struct commit_reflog));
|
||||
CALLOC_ARRAY(commit_reflog, 1);
|
||||
if (recno < 0) {
|
||||
commit_reflog->recno = get_reflog_recno_by_time(reflogs, timestamp);
|
||||
if (commit_reflog->recno < 0) {
|
||||
|
Reference in New Issue
Block a user