From 2aef63d31c338a764099e925d35fe2a9c71348a8 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 27 Jan 2017 18:01:57 -0800 Subject: attr: convert git_check_attrs() callers to use the new API The remaining callers are all simple "I have N attributes I am interested in. I'll ask about them with various paths one by one". After this step, no caller to git_check_attrs() remains. After removing it, we can extend "struct attr_check" struct with data that can be used in optimizing the query for the specific N attributes it contains. Signed-off-by: Junio C Hamano Signed-off-by: Stefan Beller Signed-off-by: Brandon Williams Signed-off-by: Junio C Hamano --- ws.c | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'ws.c') diff --git a/ws.c b/ws.c index fbd876e84..a07caedd5 100644 --- a/ws.c +++ b/ws.c @@ -71,24 +71,17 @@ unsigned parse_whitespace_rule(const char *string) return rule; } -static void setup_whitespace_attr_check(struct attr_check_item *check) -{ - static struct git_attr *attr_whitespace; - - if (!attr_whitespace) - attr_whitespace = git_attr("whitespace"); - check[0].attr = attr_whitespace; -} - unsigned whitespace_rule(const char *pathname) { - struct attr_check_item attr_whitespace_rule; + static struct attr_check *attr_whitespace_rule; + + if (!attr_whitespace_rule) + attr_whitespace_rule = attr_check_initl("whitespace", NULL); - setup_whitespace_attr_check(&attr_whitespace_rule); - if (!git_check_attrs(pathname, 1, &attr_whitespace_rule)) { + if (!git_check_attr(pathname, attr_whitespace_rule)) { const char *value; - value = attr_whitespace_rule.value; + value = attr_whitespace_rule->items[0].value; if (ATTR_TRUE(value)) { /* true (whitespace) */ unsigned all_rule = ws_tab_width(whitespace_rule_cfg); -- cgit v1.2.1