[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] v2. char_filter_callback for streams (or line_transformer)

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: Thu, 27 Aug 2009 15:17:28 +0100

Julian Foad wrote:
> Daniel Näslund wrote:
> > [[[
> > Creata a new callback for svn_stream_readline() that can replace, add or
> > delete characters from a line.
> >
> > * subversion/include/svn_io.h
> > (svn_stream_set_line_transformer_callback): Declare
> >
> > * subversion/libsvn_subr/stream.c
> > (svn_stream_set_line_transformer_callback): Sets the new callback
> >
> > * subversion/tests/libsvn_subr/stream-tests.c
> > (line_transformer): A callback of the new function. Removes leading
> > '!' characters. Does not allocate a new line.
> > (test_stream_line_transformer): tests the above callback.
> > ]]]

One more thing. You need to define and state whether the transform is
applied before or after the filter, and implement it accordingly. In
this v2 implementation, you have a mixture of both: you filter first,
but then go on to call line_transformer() on the resulting stringbuf
which may be empty as a result of the filter.

It's great that you already included a test for the transformer. It
would be really good if you could add a test for transforming and
filtering at the same time, as that seems to be an areas where there is
a lot of room for confusion and bugs.

- Julian

Received on 2009-08-27 16:18:04 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.