git-check-attr: Use git_attr_name()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Michael Haggerty committed Aug 4, 2011 at 06:36 UTC 66a1fb30335191b5ebdbcc331832e8903eb3cd0e
1 file changed +6 -7
builtin/check-attr.c
+6 -7
@@ -21,7 +21,7 @@ static const struct option check_attr_options[] = {
21 };
22
23 static void check_attr(int cnt, struct git_attr_check *check,
24 - const char** name, const char *file)
24 + const char *file)
25 {
26 int j;
27 if (git_checkattr(file, cnt, check))
@@ -37,12 +37,11 @@ static void check_attr(int cnt, struct git_attr_check *check,
37 value = "unspecified";
38
39 quote_c_style(file, NULL, stdout, 0);
40 - printf(": %s: %s\n", name[j], value);
40 + printf(": %s: %s\n", git_attr_name(check[j].attr), value);
41 }
42 }
43
44 -static void check_attr_stdin_paths(int cnt, struct git_attr_check *check,
45 - const char** name)
44 +static void check_attr_stdin_paths(int cnt, struct git_attr_check *check)
45 {
46 struct strbuf buf, nbuf;
47 int line_termination = null_term_line ? 0 : '\n';
@@ -56,7 +55,7 @@ static void check_attr_stdin_paths(int cnt, struct git_attr_check *check,
55 die("line is badly quoted");
56 strbuf_swap(&buf, &nbuf);
57 }
59 - check_attr(cnt, check, name, buf.buf);
58 + check_attr(cnt, check, buf.buf);
59 maybe_flush_or_die(stdout, "attribute to stdout");
60 }
61 strbuf_release(&buf);
@@ -113,10 +112,10 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
112 }
113
114 if (stdin_paths)
116 - check_attr_stdin_paths(cnt, check, argv);
115 + check_attr_stdin_paths(cnt, check);
116 else {
117 for (i = doubledash; i < argc; i++)
119 - check_attr(cnt, check, argv, argv[i]);
118 + check_attr(cnt, check, argv[i]);
119 maybe_flush_or_die(stdout, "attribute to stdout");
120 }
121 return 0;