From a5e92abde61d59a8612c5b87d0bae681e90f7fdb Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 18 Apr 2007 16:16:37 -0700 Subject: 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 --- builtin-check-attr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'builtin-check-attr.c') diff --git a/builtin-check-attr.c b/builtin-check-attr.c index 6983a73c1b..9d77f76ff1 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; -- cgit v1.2.3