summaryrefslogtreecommitdiff
path: root/builtin/fast-import.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2021-03-13 17:17:22 +0100
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-13 16:00:09 -0800
commitca56dadb4b65ccaeab809d80db80a312dc00941a (patch)
treefa027eb80d076ebf7be7c3ea69a92cf47e594a1c /builtin/fast-import.c
parentgit-compat-util.h: drop trailing semicolon from macro definition (diff)
downloadtgif-ca56dadb4b65ccaeab809d80db80a312dc00941a.tar.xz
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 'builtin/fast-import.c')
-rw-r--r--builtin/fast-import.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/builtin/fast-import.c b/builtin/fast-import.c
index dd4d09cece..3afa81cf9a 100644
--- a/builtin/fast-import.c
+++ b/builtin/fast-import.c
@@ -3322,7 +3322,7 @@ static void option_rewrite_submodules(const char *arg, struct string_list *list)
die(_("Expected format name:filename for submodule rewrite option"));
*f = '\0';
f++;
- ms = xcalloc(1, sizeof(*ms));
+ CALLOC_ARRAY(ms, 1);
fp = fopen(f, "r");
if (!fp)
@@ -3519,9 +3519,9 @@ int cmd_fast_import(int argc, const char **argv, const char *prefix)
alloc_objects(object_entry_alloc);
strbuf_init(&command_buf, 0);
- atom_table = xcalloc(atom_table_sz, sizeof(struct atom_str*));
- branch_table = xcalloc(branch_table_sz, sizeof(struct branch*));
- avail_tree_table = xcalloc(avail_tree_table_sz, sizeof(struct avail_tree_content*));
+ CALLOC_ARRAY(atom_table, atom_table_sz);
+ CALLOC_ARRAY(branch_table, branch_table_sz);
+ CALLOC_ARRAY(avail_tree_table, avail_tree_table_sz);
marks = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct mark_set));
hashmap_init(&object_table, object_entry_hashcmp, NULL, 0);