Re: [PATCH v2 01/11] builtin/pack-objects.c: change check_pbase_path() to use ALLOC_GROW()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Feb 28, 2014 at 4:40 PM, Dmitry S. Dolzhenko
<dmitrys.dolzhenko@xxxxxxxxx> wrote:
> Signed-off-by: Dmitry S. Dolzhenko <dmitrys.dolzhenko@xxxxxxxxx>
> ---
>  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@xxxxxxxxxxxxxxx
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Duy
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]