Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diffcore-rename.c: use ALLOC_GROW()
author
Dmitry S. Dolzhenko
<dmitrys.dolzhenko@yandex.ru>
Mon, 3 Mar 2014 22:31:54 +0000
(
02:31
+0400)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 3 Mar 2014 22:49:02 +0000
(14:49 -0800)
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>
diffcore-rename.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
4c960a4
)
diff --git
a/diffcore-rename.c
b/diffcore-rename.c
index 6c7a72fbe74e8dd6fca07d2555cdea62c16b8b1e..f54d5bf479f40752a1e65a5c5fdadc81a37facee 100644
(file)
--- 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 (!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,
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" */
}
/* 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,
rename_src_nr++;
if (first < rename_src_nr)
memmove(rename_src + first + 1, rename_src + first,