Re: [PATCH v2 01/11] builtin/pack-objects.c: change check_pbase_path() to use ALLOC_GROW()
From: Duy Nguyen <hidden>
Date: 2016-06-15 23:00:06
On Fri, Feb 28, 2014 at 4:40 PM, Dmitry S. Dolzhenko [off-list ref] wrote:
quoted hunk ↗ jump to hunk
Signed-off-by: Dmitry S. Dolzhenko <redacted> --- builtin/pack-objects.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c733379..56a6fc8 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c@@ -1213,12 +1213,7 @@ static int check_pbase_path(unsigned hash) if (0 <= pos) return 1; pos = -pos - 1; - if (done_pbase_paths_alloc <= done_pbase_paths_num) { - done_pbase_paths_alloc = alloc_nr(done_pbase_paths_alloc); - done_pbase_paths = xrealloc(done_pbase_paths, - done_pbase_paths_alloc * - sizeof(unsigned)); - } + ALLOC_GROW(done_pbase_paths, done_pbase_paths_num + 1, done_pbase_paths_alloc);
Not strictly a rule, but I usually try to keep it within 80 columns, unless the surrounding code already breaks it.
done_pbase_paths_num++;
If you move this up one line, then you don't have to "+ 1" in ALLOC_GROW
if (pos < done_pbase_paths_num)
memmove(done_pbase_paths + pos + 1,
--
1.8.5.3
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html-- Duy