summaryrefslogtreecommitdiff
path: root/convert.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2011-05-21 21:05:51 (GMT)
committerJunio C Hamano <gitster@pobox.com>2011-05-26 23:47:15 (GMT)
commit4ae6670444388f5ba68850e42a93af4019922c26 (patch)
treea065ece4a58a8f4030e77a8c26ae1391a48ae40c /convert.c
parentb6691092d707860019bbab80eaaf9173ada10586 (diff)
downloadgit-4ae6670444388f5ba68850e42a93af4019922c26.zip
git-4ae6670444388f5ba68850e42a93af4019922c26.tar.gz
git-4ae6670444388f5ba68850e42a93af4019922c26.tar.bz2
stream filter: add "no more input" to the filters
Some filters may need to buffer the input and look-ahead inside it to decide what to output, and they may consume more than zero bytes of input and still not produce any output. After feeding all the input, pass NULL as input as keep calling stream_filter() to let such filters know there is no more input coming, and it is time for them to produce the remaining output based on the buffered input. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'convert.c')
-rw-r--r--convert.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/convert.c b/convert.c
index 1ec91a3..4951372 100644
--- a/convert.c
+++ b/convert.c
@@ -838,7 +838,11 @@ static int null_filter_fn(struct stream_filter *filter,
const char *input, size_t *isize_p,
char *output, size_t *osize_p)
{
- size_t count = *isize_p;
+ size_t count;
+
+ if (!input)
+ return 0; /* we do not keep any states */
+ count = *isize_p;
if (*osize_p < count)
count = *osize_p;
if (count) {