summaryrefslogtreecommitdiff
path: root/diffcore-rename.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2014-03-18 20:50:21 (GMT)
committerJunio C Hamano <gitster@pobox.com>2014-03-18 20:50:21 (GMT)
commitfe9122a35213827348c521a16ffd0cf2652c4ac5 (patch)
tree7feb62b93a1b90ad365f582e926c11b75d847686 /diffcore-rename.c
parenta8e1d711cc9531463fe312875553d56624eb9c37 (diff)
parentc7353967ca8ede681e9f8fbac98a650450631990 (diff)
downloadgit-fe9122a35213827348c521a16ffd0cf2652c4ac5.zip
git-fe9122a35213827348c521a16ffd0cf2652c4ac5.tar.gz
git-fe9122a35213827348c521a16ffd0cf2652c4ac5.tar.bz2
Merge branch 'dd/use-alloc-grow'
Replace open-coded reallocation with ALLOC_GROW() macro. * dd/use-alloc-grow: sha1_file.c: use ALLOC_GROW() in pretend_sha1_file() read-cache.c: use ALLOC_GROW() in add_index_entry() builtin/mktree.c: use ALLOC_GROW() in append_to_tree() attr.c: use ALLOC_GROW() in handle_attr_line() dir.c: use ALLOC_GROW() in create_simplify() reflog-walk.c: use ALLOC_GROW() replace_object.c: use ALLOC_GROW() in register_replace_object() patch-ids.c: use ALLOC_GROW() in add_commit() diffcore-rename.c: use ALLOC_GROW() diff.c: use ALLOC_GROW() commit.c: use ALLOC_GROW() in register_commit_graft() cache-tree.c: use ALLOC_GROW() in find_subtree() bundle.c: use ALLOC_GROW() in add_to_ref_list() builtin/pack-objects.c: use ALLOC_GROW() in check_pbase_path()
Diffstat (limited to 'diffcore-rename.c')
-rw-r--r--diffcore-rename.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/diffcore-rename.c b/diffcore-rename.c
index 39effec..749a35d 100644
--- a/diffcore-rename.c
+++ b/diffcore-rename.c
@@ -38,11 +38,7 @@ static struct diff_rename_dst *locate_rename_dst(struct diff_filespec *two,
if (!insert_ok)
return NULL;
/* insert to make it at "first" */
- if (rename_dst_alloc <= rename_dst_nr) {
- rename_dst_alloc = alloc_nr(rename_dst_alloc);
- rename_dst = xrealloc(rename_dst,
- rename_dst_alloc * sizeof(*rename_dst));
- }
+ ALLOC_GROW(rename_dst, rename_dst_nr + 1, rename_dst_alloc);
rename_dst_nr++;
if (first < rename_dst_nr)
memmove(rename_dst + first + 1, rename_dst + first,
@@ -82,11 +78,7 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
}
/* insert to make it at "first" */
- if (rename_src_alloc <= rename_src_nr) {
- rename_src_alloc = alloc_nr(rename_src_alloc);
- rename_src = xrealloc(rename_src,
- rename_src_alloc * sizeof(*rename_src));
- }
+ ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc);
rename_src_nr++;
if (first < rename_src_nr)
memmove(rename_src + first + 1, rename_src + first,