summaryrefslogtreecommitdiff
path: root/attr.h
diff options
context:
space:
mode:
authorBrandon Williams <bmwill@google.com>2017-01-28 02:02:05 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-02-01 21:46:53 (GMT)
commitdc81cf377cd25193a9cf044767917e4f5553c285 (patch)
treec5e941a96229ac5a008b3d538e809f89dbc51093 /attr.h
parente810e0635767afbc9b304d5256fbdb26b59644fa (diff)
downloadgit-dc81cf377cd25193a9cf044767917e4f5553c285.zip
git-dc81cf377cd25193a9cf044767917e4f5553c285.tar.gz
git-dc81cf377cd25193a9cf044767917e4f5553c285.tar.bz2
attr: store attribute stack in attr_check structure
The last big hurdle towards a thread-safe API for the attribute system is the reliance on a global attribute stack that is modified during each call into the attribute system. This patch removes this global stack and instead a stack is stored locally in each attr_check instance. This opens up the opportunity for future optimizations to customize the attribute stack for the attributes that a particular attr_check struct is interested in. One caveat with pushing the attribute stack into the attr_check structure is that the attribute system now needs to keep track of all active attr_check instances. Due to the direction mechanism the stack needs to be dropped when the direction is switched. In order to ensure correctness when the direction is changed the attribute system needs to iterate through all active attr_check instances and drop each of their stacks. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'attr.h')
-rw-r--r--attr.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/attr.h b/attr.h
index abebbc1..6f4961f 100644
--- a/attr.h
+++ b/attr.h
@@ -4,8 +4,9 @@
/* An attribute is a pointer to this opaque structure */
struct git_attr;
-/* opaque structure used internally for attribute collection */
+/* opaque structures used internally for attribute collection */
struct all_attrs_item;
+struct attr_stack;
/*
* Given a string, return the gitattribute object that
@@ -38,6 +39,7 @@ struct attr_check {
struct attr_check_item *items;
int all_attrs_nr;
struct all_attrs_item *all_attrs;
+ struct attr_stack *stack;
};
extern struct attr_check *attr_check_alloc(void);