summaryrefslogtreecommitdiff
path: root/reflog-walk.c
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-03-13 16:17:22 (GMT)
committerJunio C Hamano <gitster@pobox.com>2021-03-14 00:00:09 (GMT)
commitca56dadb4b65ccaeab809d80db80a312dc00941a (patch)
treefa027eb80d076ebf7be7c3ea69a92cf47e594a1c /reflog-walk.c
parentf1121499e6460e814ec3cffa0b18942ac529f768 (diff)
downloadgit-ca56dadb4b65ccaeab809d80db80a312dc00941a.zip
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.gz
git-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.bz2
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>
Diffstat (limited to 'reflog-walk.c')
-rw-r--r--reflog-walk.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/reflog-walk.c b/reflog-walk.c
index 3a25b27..e9cd328 100644
--- a/reflog-walk.c
+++ b/reflog-walk.c
@@ -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) {