diffcore-rename.c: use ALLOC_GROW()

Use ALLOC_GROW() instead of open-coding it in locate_rename_dst() and register_rename_src(). Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Dmitry S. Dolzhenko committed Mar 4, 2014 at 02:31 UTC 337ce247e35b88e8413ab80b43d9ce47729c8136
1 file changed +2 -10
diffcore-rename.c
+2 -10
@@ -38,11 +38,7 @@ static struct diff_rename_dst *locate_rename_dst(struct diff_filespec *two,
38 if (!insert_ok)
39 return NULL;
40 /* insert to make it at "first" */
41 - if (rename_dst_alloc <= rename_dst_nr) {
42 - rename_dst_alloc = alloc_nr(rename_dst_alloc);
43 - rename_dst = xrealloc(rename_dst,
44 - rename_dst_alloc * sizeof(*rename_dst));
45 - }
41 + ALLOC_GROW(rename_dst, rename_dst_nr + 1, rename_dst_alloc);
42 rename_dst_nr++;
43 if (first < rename_dst_nr)
44 memmove(rename_dst + first + 1, rename_dst + first,
@@ -82,11 +78,7 @@ static struct diff_rename_src *register_rename_src(struct diff_filepair *p)
78 }
79
80 /* insert to make it at "first" */
85 - if (rename_src_alloc <= rename_src_nr) {
86 - rename_src_alloc = alloc_nr(rename_src_alloc);
87 - rename_src = xrealloc(rename_src,
88 - rename_src_alloc * sizeof(*rename_src));
89 - }
81 + ALLOC_GROW(rename_src, rename_src_nr + 1, rename_src_alloc);
82 rename_src_nr++;
83 if (first < rename_src_nr)
84 memmove(rename_src + first + 1, rename_src + first,