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

Re: [PATCH 3/5] fixup! d5ad6c13

From
Stefan Beller <sbeller@google.com>
Date
Jun 9, 2016, 00:00 UTC
Message-ID
<CAGZ79kYjaWJ8=3rizFE+EZXS3P1LjX8bGD-6LwfmjG83cjgVJQ@mail.gmail.com>
In-Reply-To
<20160608225818.726-4-gitster@pobox.com>
On Wed, Jun 8, 2016 at 3:58 PM, Junio C Hamano <gitster@pobox.com> wrote:
> As the topic is in 'next' already, I'll leave this floating near the
> tip for now, until we can rewind the topic after the next release.
I don't quite understand the motivation behind this commit.
    We return the last element to allow succeeding operations
    access to the bottom of the stack without needing to walk it?
    This makes the follow up operations faster, because we expect the stack
    to be larger than 5 elements.
?
Show 49 quoted lines
> ---
>  attr.c | 9 ++++++---
>  attr.h | 2 +-
>  2 files changed, 7 insertions(+), 4 deletions(-)
>
> diff --git a/attr.c b/attr.c
> index 4e2172a..0e61950 100644
> --- a/attr.c
> +++ b/attr.c
> @@ -899,13 +899,16 @@ struct git_attr_check *git_attr_check_alloc(void)
>         return xcalloc(1, sizeof(struct git_attr_check));
>  }
>
> -void git_attr_check_append(struct git_attr_check *check,
> -                          const struct git_attr *attr)
> +struct git_attr_check_elem *git_attr_check_append(struct git_attr_check *check,
> +                                                 const struct git_attr *attr)
>  {
> +       struct git_attr_check_elem *elem;
>         if (check->finalized)
>                 die("BUG: append after git_attr_check structure is finalized");
>         ALLOC_GROW(check->check, check->check_nr + 1, check->check_alloc);
> -       check->check[check->check_nr++].attr = attr;
> +       elem = &check->check[check->check_nr++];
> +       elem->attr = attr;
> +       return elem;
>  }
>
>  void git_attr_check_clear(struct git_attr_check *check)
> diff --git a/attr.h b/attr.h
> index fc72030..40abc16 100644
> --- a/attr.h
> +++ b/attr.h
> @@ -47,7 +47,7 @@ extern int git_check_attr(const char *path, struct git_attr_check *);
>  extern int git_check_attr_counted(const char *, int, struct git_attr_check *);
>
>  extern struct git_attr_check *git_attr_check_alloc(void);
> -extern void git_attr_check_append(struct git_attr_check *, const struct git_attr *);
> +extern struct git_attr_check_elem *git_attr_check_append(struct git_attr_check *, const struct git_attr *);
>
>  extern void git_attr_check_clear(struct git_attr_check *);
>  extern void git_attr_check_free(struct git_attr_check *);
> --
> 2.9.0-rc2-262-g9161bbf
>
> --
> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 13 in “A bit more "attributes"”
  1. 0/5 A bit more "attributes"Junio C Hamano, Jun 8, 2016
  2. 1/5 attr.c: add push_stack() helperJunio C Hamano, Jun 8, 2016
  3. Stefan BellerJun 8, 2016
  4. Junio C HamanoJun 9, 2016
  5. 2/5 attr.c: pass struct git_attr_check down the callchainJunio C Hamano, Jun 8, 2016
  6. Stefan BellerJun 8, 2016
  7. 3/5 fixup! d5ad6c13Junio C Hamano, Jun 8, 2016
  8. Stefan BellerJun 9, 2016
  9. Junio C HamanoJun 9, 2016
  10. 4/5 attr.c: correct ugly hack for git_all_attrs()Junio C Hamano, Jun 8, 2016
  11. 5/5 attr.c: always pass check[] to collect_some_attrs()Junio C Hamano, Jun 8, 2016
  12. Stefan BellerJun 9, 2016
  13. Junio C HamanoJun 9, 2016

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.