diff options
author | Russell Belfer <rb@github.com> | 2012-11-28 09:58:48 -0800 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-11-28 09:58:48 -0800 |
commit | 7bf87ab6987cf6b9e166e23d2d9dbdcd2511fb32 (patch) | |
tree | dcc8a92ce69b2a0d9d8cca98d67f0cc71177ce40 /src/filter.h | |
parent | 693021262ba0eeac2923bbce1b2262717019c807 (diff) | |
download | libgit2-7bf87ab6987cf6b9e166e23d2d9dbdcd2511fb32.tar.gz |
Consolidate text buffer functions
There are many scattered functions that look into the contents of
buffers to do various text manipulations (such as escaping or
unescaping data, calculating text stats, guessing if content is
binary, etc). This groups all those functions together into a
new file and converts the code to use that.
This has two enhancements to existing functionality. The old
text stats function is significantly rewritten and the BOM
detection code was extended (although largely we can't deal with
anything other than a UTF8 BOM).
Diffstat (limited to 'src/filter.h')
-rw-r--r-- | src/filter.h | 29 |
1 files changed, 1 insertions, 28 deletions
diff --git a/src/filter.h b/src/filter.h index b9beb4942..2b5051c69 100644 --- a/src/filter.h +++ b/src/filter.h @@ -9,6 +9,7 @@ #include "common.h" #include "buffer.h" +#include "buf_text.h" #include "git2/odb.h" #include "git2/repository.h" @@ -31,14 +32,6 @@ typedef enum { GIT_CRLF_AUTO, } git_crlf_t; -typedef struct { - /* NUL, CR, LF and CRLF counts */ - unsigned int nul, cr, lf, crlf; - - /* These are just approximations! */ - unsigned int printable, nonprintable; -} git_text_stats; - /* * FILTER API */ @@ -99,24 +92,4 @@ extern int git_filter_add__crlf_to_odb(git_vector *filters, git_repository *repo /* Add CRLF, from ODB to worktree */ extern int git_filter_add__crlf_to_workdir(git_vector *filters, git_repository *repo, const char *path); - -/* - * PLAINTEXT API - */ - -/* - * Gather stats for a piece of text - * - * Fill the `stats` structure with information on the number of - * unreadable characters, carriage returns, etc, so it can be - * used in heuristics. - */ -extern void git_text_gather_stats(git_text_stats *stats, const git_buf *text); - -/* - * Process `git_text_stats` data generated by `git_text_stat` to see - * if it qualifies as a binary file - */ -extern int git_text_is_binary(git_text_stats *stats); - #endif |