summaryrefslogtreecommitdiff
path: root/src/buf_text.c
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-01-11 11:35:09 -0800
committerVicent Martí <vicent@github.com>2013-01-11 11:35:09 -0800
commit160e4fb792b070e14c7094893e390c53d788648c (patch)
treef5a999ef69d8ec8e8616d4a7b8b113b1f0522aa3 /src/buf_text.c
parent6e19edaa40559a53b8fbf544fe0a6d1f05096614 (diff)
parent0d65acade84a5ff2421cd52de82a8963f004d481 (diff)
downloadlibgit2-160e4fb792b070e14c7094893e390c53d788648c.tar.gz
Merge pull request #1230 from arrbee/match-core-git-diff-binary-detection
Match binary file check of core git in diff
Diffstat (limited to 'src/buf_text.c')
-rw-r--r--src/buf_text.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/buf_text.c b/src/buf_text.c
index a7122dc0c..0104a9057 100644
--- a/src/buf_text.c
+++ b/src/buf_text.c
@@ -109,6 +109,11 @@ bool git_buf_text_is_binary(const git_buf *buf)
return ((printable >> 7) < nonprintable);
}
+bool git_buf_text_contains_nul(const git_buf *buf)
+{
+ return (strnlen(buf->ptr, buf->size) != buf->size);
+}
+
int git_buf_text_detect_bom(git_bom_t *bom, const git_buf *buf, size_t offset)
{
const char *ptr;