Re: [PATCH 2/6] [GSOC] ref-filter: add %(raw) atom

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

 



Junio C Hamano <gitster@xxxxxxxxx> 于2021年6月8日周二 下午1:07写道:
>
> This breaks -Wdecl-after-stmt.  A possible fix below.
>
> diff --git a/ref-filter.c b/ref-filter.c
> index 46aec291de..648f9cabff 100644
> --- a/ref-filter.c
> +++ b/ref-filter.c
> @@ -2459,13 +2459,13 @@ static int cmp_ref_sorting(struct ref_sorting *s, struct ref_array_item *a, stru
>                                 ? strcasecmp : strcmp;
>                         cmp = cmp_fn(va->s, vb->s);
>                 } else {
> -                       int (*cmp_fn)(const void *, const void *, size_t);
> -                       cmp_fn = s->sort_flags & REF_SORTING_ICASE
> +                       size_t a_size = va->s_size == ATOM_VALUE_S_SIZE_INIT
> +                                       ? strlen(va->s) : va->s_size;
> +                       size_t b_size = vb->s_size == ATOM_VALUE_S_SIZE_INIT
> +                                       ? strlen(vb->s) : vb->s_size;
> +                       int (*cmp_fn)(const void *, const void *, size_t) =
> +                               s->sort_flags & REF_SORTING_ICASE
>                                 ? memcasecmp : memcmp;
> -                       size_t a_size = va->s_size == ATOM_VALUE_S_SIZE_INIT ?
> -                                       strlen(va->s) : va->s_size;
> -                       size_t b_size = vb->s_size == ATOM_VALUE_S_SIZE_INIT ?
> -                                       strlen(vb->s) : vb->s_size;
>
>                         cmp = cmp_fn(va->s, vb->s, b_size > a_size ?
>                                      a_size : b_size);

You are right.

Thanks.
--
ZheNing Hu




[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]

  Powered by Linux