Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
reflog-walk.c: use ALLOC_GROW()
author
Dmitry S. Dolzhenko
<dmitrys.dolzhenko@yandex.ru>
Mon, 3 Mar 2014 22:31:57 +0000
(
02:31
+0400)
committer
Junio C Hamano
<gitster@pobox.com>
Mon, 3 Mar 2014 22:53:57 +0000
(14:53 -0800)
Use ALLOC_GROW() instead of open-coding it in add_commit_info() and
read_one_reflog().
Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
reflog-walk.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
72004b4
)
diff --git
a/reflog-walk.c
b/reflog-walk.c
index b2fbdb2392f80a531d5f9a21630a036d45c0a827..2899729a8cbec4766182a1562c0c96d643de3a71 100644
(file)
--- a/
reflog-walk.c
+++ b/
reflog-walk.c
@@
-26,11
+26,7
@@
static int read_one_reflog(unsigned char *osha1, unsigned char *nsha1,
struct complete_reflogs *array = cb_data;
struct reflog_info *item;
struct complete_reflogs *array = cb_data;
struct reflog_info *item;
- if (array->nr >= array->alloc) {
- array->alloc = alloc_nr(array->nr + 1);
- array->items = xrealloc(array->items, array->alloc *
- sizeof(struct reflog_info));
- }
+ ALLOC_GROW(array->items, array->nr + 1, array->alloc);
item = array->items + array->nr;
memcpy(item->osha1, osha1, 20);
memcpy(item->nsha1, nsha1, 20);
item = array->items + array->nr;
memcpy(item->osha1, osha1, 20);
memcpy(item->nsha1, nsha1, 20);
@@
-114,11
+110,7
@@
static void add_commit_info(struct commit *commit, void *util,
struct commit_info_lifo *lifo)
{
struct commit_info *info;
struct commit_info_lifo *lifo)
{
struct commit_info *info;
- if (lifo->nr >= lifo->alloc) {
- lifo->alloc = alloc_nr(lifo->nr + 1);
- lifo->items = xrealloc(lifo->items,
- lifo->alloc * sizeof(struct commit_info));
- }
+ ALLOC_GROW(lifo->items, lifo->nr + 1, lifo->alloc);
info = lifo->items + lifo->nr;
info->commit = commit;
info->util = util;
info = lifo->items + lifo->nr;
info->commit = commit;
info->util = util;