Re: [PATCH v2 01/11] builtin/pack-objects.c: change check_pbase_path() to use ALLOC_GROW()
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Feb 28, 2014, 12:32 UTC
- Message-ID
- <CACsJy8C2h13JFqh=CKvR=3TByHkxWCNR-XhK-WxA+DOE3GmvAQ@mail.gmail.com>
- In-Reply-To
- <53105995.3010001@yandex.ru>
On Fri, Feb 28, 2014 at 4:40 PM, Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru> wrote:
Show 20 quoted lines
> Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@yandex.ru>
> ---
> 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
Show 9 quoted lines
> 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