Download raw body.
diff: limit search effort for function prototypes
Stefan Sperling:
> > GNU diff caches the last function prototype and the line number
> > from which it started searching.
> 
> Yes, we could. This is a great idea. Implemented below. This approach
> is also much faster than my previous patch.
> 
> So with this diff we only search the 'left' version of the file for
> prototypes. But that's probably how other diff tools do it as well.
Yes, GNU diff does this as well.
> ok?
Basically, yes.
That's a malloc/free for each prototype.  Would a static buffer in
the state be better?
> --- lib/diff_output_unidiff.c
> +++ lib/diff_output_unidiff.c
>  	if (left_len == 1 && right_len == 1) {
>  		rc = fprintf(dest, "@@ -%d +%d @@%s%s\n",
>  			left_start, right_start,
> -			prototype ? " " : "",
> -			prototype ? : "");
> +			state->prototype ? " " : "",
> +			state->prototype ? : "");
That is not C.  I had to look it up: "x ? : y" is a GCC extension.
Something for a separate clean-up commit, I guess.
-- 
Christian "naddy" Weisgerber                          naddy@mips.inka.de
diff: limit search effort for function prototypes