Re: [PATCH 28/36] attr: keep attr stack for each check
- From
Ramsay Jones <ramsay@ramsayjones.plus.com>
- Date
- Oct 23, 2016, 15:10 UTC
- Message-ID
- <8a91d287-5413-3f8f-9d0e-edd67fb36557@ramsayjones.plus.com>
- In-Reply-To
- <20161022233225.8883-29-sbeller@google.com>
On 23/10/16 00:32, Stefan Beller wrote:
Show 34 quoted lines
> Instead of having a global attr stack, attach the stack to each check.
> This allows to use the attr in a multithreaded way.
>
>
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
> attr.c | 101 +++++++++++++++++++++++++++++++++++++++-----------------------
> attr.h | 4 ++-
> hashmap.h | 2 ++
> 3 files changed, 69 insertions(+), 38 deletions(-)
>
> diff --git a/attr.c b/attr.c
> index 89ae155..b65437d 100644
> --- a/attr.c
> +++ b/attr.c
> @@ -372,15 +372,17 @@ static struct match_attr *parse_attr_line(const char *line, const char *src,
> * .gitignore file and info/excludes file as a fallback.
> */
>
> -/* NEEDSWORK: This will become per git_attr_check */
> -static struct attr_stack {
> +struct attr_stack {
> struct attr_stack *prev;
> char *origin;
> size_t originlen;
> unsigned num_matches;
> unsigned alloc;
> struct match_attr **attrs;
> -} *attr_stack;
> +};
> +
> +struct hashmap all_attr_stacks;
> +int all_attr_stacks_init;Mark symbols 'all_attr_stacks' and 'all_attr_stacks_init' with the static keyword. (ie. these are file-local symbols).
ATB, Ramsay Jones