diff options
author | Johannes Schindelin <Johannes.Schindelin@gmx.de> | 2007-06-05 03:36:11 +0100 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-06-15 23:27:23 -0700 |
commit | 634cd48a8afdd920fa26c8ec3ae43e96c82c81f2 (patch) | |
tree | ef740f010a3a287514ce61583b8e92581621fecf /grep.c | |
parent | fa0c87c34471286b6c261c781a45ed090135295c (diff) | |
download | git-634cd48a8afdd920fa26c8ec3ae43e96c82c81f2.tar.gz git-634cd48a8afdd920fa26c8ec3ae43e96c82c81f2.tar.xz |
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.
[jc: cherry-picked 6bfce93e from 'master']
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'grep.c')
-rw-r--r-- | grep.c | 12 |
1 files changed, 1 insertions, 11 deletions
@@ -1,5 +1,6 @@ #include "cache.h" #include "grep.h" +#include "xdiff-interface.h" void append_grep_pattern(struct grep_opt *opt, const char *pat, const char *origin, int no, enum grep_pat_token t) @@ -232,17 +233,6 @@ static void show_line(struct grep_opt *opt, const char *bol, const char *eol, printf("%.*s\n", (int)(eol-bol), bol); } -/* - * NEEDSWORK: share code with diff.c - */ -#define FIRST_FEW_BYTES 8000 -static int buffer_is_binary(const char *ptr, unsigned long size) -{ - if (FIRST_FEW_BYTES < size) - size = FIRST_FEW_BYTES; - return !!memchr(ptr, 0, size); -} - static int fixmatch(const char *pattern, char *line, regmatch_t *match) { char *hit = strstr(line, pattern); |