path: root/builtin-check-attr.c
diff options
authorJunio C Hamano <>2007-04-18 23:16:37 (GMT)
committerJunio C Hamano <>2007-04-18 23:17:13 (GMT)
commita5e92abde61d59a8612c5b87d0bae681e90f7fdb (patch)
treee53fefb050e87cb63d06d016ffec73e2a67f2bf2 /builtin-check-attr.c
parent3086486d326b00ce308208e62e0e0de831f3563b (diff)
Fix funny types used in attribute value representation
It was bothering me a lot that I abused small integer values casted to (void *) to represent non string values in gitattributes. This corrects it by making the type of attribute values (const char *), and using the address of a few statically allocated character buffer to denote true/false. Unset attributes are represented as having NULLs as their values. Added in-header documentation to explain how git_checkattr() routine should be called. Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'builtin-check-attr.c')
1 files changed, 2 insertions, 2 deletions
diff --git a/builtin-check-attr.c b/builtin-check-attr.c
index 6983a73..9d77f76 100644
--- a/builtin-check-attr.c
+++ b/builtin-check-attr.c
@@ -42,7 +42,7 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
if (git_checkattr(argv[i], cnt, check))
die("git_checkattr died");
for (j = 0; j < cnt; j++) {
- void *value = check[j].value;
+ const char *value = check[j].value;
if (ATTR_TRUE(value))
value = "set";
@@ -52,7 +52,7 @@ int cmd_check_attr(int argc, const char **argv, const char *prefix)
value = "unspecified";
write_name_quoted("", 0, argv[i], 1, stdout);
- printf(": %s: %s\n", argv[j+1], (char *) value);
+ printf(": %s: %s\n", argv[j+1], value);
return 0;