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 --- diff.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'diff.c') diff --git a/diff.c b/diff.c index a32078ea01..5f501864e6 100644 --- a/diff.c +++ b/diff.c @@ -1069,7 +1069,7 @@ static int file_is_binary(struct diff_filespec *one) setup_diff_attr_check(&attr_diff_check); if (!git_checkattr(one->path, 1, &attr_diff_check)) { - void *value = attr_diff_check.value; + const char *value = attr_diff_check.value; if (ATTR_TRUE(value)) return 0; else if (ATTR_FALSE(value)) @@ -1078,7 +1078,7 @@ static int file_is_binary(struct diff_filespec *one) ; else die("unknown value %s given to 'diff' attribute", - (char *)value); + value); } if (!one->data) { -- cgit v1.2.1