git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
ZheNing Hu <adlternative@gmail.com>
Date
Jun 8, 2021, 06:10 UTC
Message-ID
<CAOLTT8QPMVueHMFCYP6YJ9_ODsKFxk2gyB1dO5ak=UFX-8Cm-A@mail.gmail.com>
In-Reply-To
<xmqqa6o1q6zz.fsf@gitster.g>
Junio C Hamano <gitster@pobox.com> 于2021年6月8日周二 下午1:07写道:
Show 27 quoted lines
>
> 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

Previous: Junio C HamanoNext: ZheNing Hu via GitGitGadget
Message 4 of 27 in “[GSOC][RFC] ref-filter: add %(raw:textconv) and %(raw:filters)”
  1. 0/6 [GSOC][RFC] ref-filter: add %(raw:textconv) and %(raw:filters)ZheNing Hu via GitGitGadget, Jun 5, 2021
  2. 2/6 [GSOC] ref-filter: add %(raw) atomZheNing Hu via GitGitGadget, Jun 5, 2021
  3. Junio C HamanoJun 8, 2021
  4. ZheNing HuJun 8, 2021
  5. 1/6 [GSOC] ref-filter: add obj-type check in grab contentsZheNing Hu via GitGitGadget, Jun 5, 2021
  6. 3/6 [GSOC] ref-filter: use non-const ref_format in *_atom_parser()ZheNing Hu via GitGitGadget, Jun 5, 2021
  7. 5/6 [GSOC] ref-filter: teach grab_sub_body_contents() return value and errZheNing Hu via GitGitGadget, Jun 5, 2021
  8. 4/6 [GSOC] ref-filter: add %(rest) atom and --rest optionZheNing Hu via GitGitGadget, Jun 5, 2021
  9. Hariom vermaJun 5, 2021
  10. ZheNing HuJun 6, 2021
  11. Junio C HamanoJun 7, 2021
  12. ZheNing HuJun 7, 2021
  13. ZheNing HuJun 7, 2021
  14. ZheNing HuJun 8, 2021
  15. Junio C HamanoJun 8, 2021
  16. ZheNing HuJun 8, 2021
  17. Junio C HamanoJun 9, 2021
  18. ZheNing HuJun 9, 2021
  19. Junio C HamanoJun 8, 2021
  20. ZheNing HuJun 8, 2021
  21. 6/6 [GSOC] ref-filter: add %(raw:textconv) and %(raw:filters)ZheNing Hu via GitGitGadget, Jun 5, 2021
  22. Bagas SanjayaJun 5, 2021
  23. ZheNing HuJun 5, 2021
  24. Junio C HamanoJun 7, 2021
  25. ZheNing HuJun 7, 2021
  26. Junio C HamanoJun 8, 2021
  27. ZheNing HuJun 8, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.