Re: [PATCH 28/36] attr: keep attr stack for each check
From: Ramsay Jones <hidden>
Date: 2016-10-23 15:10:45
On 23/10/16 00:32, Stefan Beller wrote:
quoted hunk ↗ jump to hunk
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 <redacted> --- 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