On Wed, Apr 14, 2010 at 05:49:51PM +0200, Daniel Näslund wrote:
> On Wed, Apr 14, 2010 at 05:35:36PM +0200, Stefan Sperling wrote:
> > I.e. we'll add some optional magic in match_hunk(), making it skip over
> > whitespace on either side (as determined by isspace()), but comparing
> > any other characters.
>
> Note that a whitespace may be tabs beeing translated to spaces, e.g.
> it's not enough to just look at the trailing or leading whitespaces.
Yes. I meant either side as in "original and modified text", not as
in "start and end" :) I could have phrased this better.
> I've used this approach (comparing the the lines with all whitespaces
> removed):
> [[[
> if (ignore_whitespaces)
> {
> char *stripped_hunk_line = apr_pstrdup(pool,
> hunk_line_translated);
> char *stripped_target_line = apr_pstrdup(pool, target_line);
>
> apr_collapse_spaces(stripped_hunk_line,
> hunk_line_translated);
> apr_collapse_spaces(stripped_target_line, target_line);
> lines_matched = ! strcmp(stripped_hunk_line,
> stripped_target_line);
> }
> ]]]
Looks fine.
Stefan