From df4cba0f2860f35ddea03e09d40ec27b9717db70 Mon Sep 17 00:00:00 2001 From: joshaber Date: Tue, 15 Jul 2014 17:27:58 -0700 Subject: Export git_buf_text_is_binary and git_buf_text_contains_nul. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So that users don’t need to implement binary detection themselves. --- include/git2/buf_text.h | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 include/git2/buf_text.h (limited to 'include/git2') diff --git a/include/git2/buf_text.h b/include/git2/buf_text.h new file mode 100644 index 000000000..29bfca80d --- /dev/null +++ b/include/git2/buf_text.h @@ -0,0 +1,42 @@ +/* + * Copyright (C) the libgit2 contributors. All rights reserved. + * + * This file is part of libgit2, distributed under the GNU GPL v2 with + * a Linking Exception. For full terms see the included COPYING file. + */ +#ifndef INCLUDE_git_buf_text_h__ +#define INCLUDE_git_buf_text_h__ + +#include "common.h" +#include "buffer.h" + +/** + * @file git2/buf_text.h + * @brief Buffer text export structure + * + * @ingroup Git + * @{ + */ +GIT_BEGIN_DECL + +/** + * Check quickly if buffer looks like it contains binary data + * + * @param buf Buffer to check + * @return 1 if buffer looks like non-text data + */ +GIT_EXTERN(int) git_buf_text_is_binary(const git_buf *buf); + +/** + * Check quickly if buffer contains a NUL byte + * + * @param buf Buffer to check + * @return 1 if buffer contains a NUL byte + */ +GIT_EXTERN(int) git_buf_text_contains_nul(const git_buf *buf); + +GIT_END_DECL + +/** @} */ + +#endif -- cgit v1.2.1