summaryrefslogtreecommitdiff
path: root/diff.c
diff options
context:
space:
mode:
authorJohannes Schindelin <Johannes.Schindelin@gmx.de>2007-06-05 03:36:11 +0100
committerJunio C Hamano <gitster@pobox.com>2007-06-04 23:07:00 -0700
commit6bfce93e04d13ecb42008a3cf214cc892f480f0c (patch)
tree1a6a391821add13a0e57f3e4b6df0a272fb76834 /diff.c
parent20f1eb6b46645115695329a371d412eb3e714865 (diff)
downloadgit-6bfce93e04d13ecb42008a3cf214cc892f480f0c.tar.gz
Move buffer_is_binary() to xdiff-interface.h
We already have two instances where we want to determine if a buffer contains binary data as opposed to text. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff.c')
-rw-r--r--diff.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/diff.c b/diff.c
index 508bc51ed5..c57ac33414 100644
--- a/diff.c
+++ b/diff.c
@@ -1107,10 +1107,8 @@ static void setup_diff_attr_check(struct git_attr_check *check)
check->attr = attr_diff;
}
-#define FIRST_FEW_BYTES 8000
static int file_is_binary(struct diff_filespec *one)
{
- unsigned long sz;
struct git_attr_check attr_diff_check;
setup_diff_attr_check(&attr_diff_check);
@@ -1127,10 +1125,7 @@ static int file_is_binary(struct diff_filespec *one)
return 0;
diff_populate_filespec(one, 0);
}
- sz = one->size;
- if (FIRST_FEW_BYTES < sz)
- sz = FIRST_FEW_BYTES;
- return !!memchr(one->data, 0, sz);
+ return buffer_is_binary(one->data, one->size);
}
static void builtin_diff(const char *name_a,