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()
This commit is contained in:
@ -41,12 +41,8 @@ static int register_replace_object(struct replace_object *replace,
|
||||
return 1;
|
||||
}
|
||||
pos = -pos - 1;
|
||||
if (replace_object_alloc <= ++replace_object_nr) {
|
||||
replace_object_alloc = alloc_nr(replace_object_alloc);
|
||||
replace_object = xrealloc(replace_object,
|
||||
sizeof(*replace_object) *
|
||||
replace_object_alloc);
|
||||
}
|
||||
ALLOC_GROW(replace_object, replace_object_nr + 1, replace_object_alloc);
|
||||
replace_object_nr++;
|
||||
if (pos < replace_object_nr)
|
||||
memmove(replace_object + pos + 1,
|
||||
replace_object + pos,
|
||||
|
Reference in New Issue
Block a user