summaryrefslogtreecommitdiff
path: root/xdiff-interface.c
diff options
context:
space:
mode:
Diffstat (limited to 'xdiff-interface.c')
-rw-r--r--xdiff-interface.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xdiff-interface.c b/xdiff-interface.c
index 10816e95a0..963bb89b08 100644
--- a/xdiff-interface.c
+++ b/xdiff-interface.c
@@ -122,4 +122,12 @@ int read_mmfile(mmfile_t *ptr, const char *filename)
return 0;
}
+#define FIRST_FEW_BYTES 8000
+int buffer_is_binary(const char *ptr, unsigned long size)
+{
+ if (FIRST_FEW_BYTES < size)
+ size = FIRST_FEW_BYTES;
+ return !!memchr(ptr, 0, size);
+}
+