[PATCH 2 of 2 STABLE] bdiff: remove effectively dead code

Augie Fackler raf at durin42.com
Fri Jun 3 22:47:28 EDT 2016


On Fri, Jun 03, 2016 at 12:48:52PM -0500, Matt Mackall wrote:
> # HG changeset patch
> # User Matt Mackall <mpm at selenic.com>
> # Date 1464905492 18000
> #      Thu Jun 02 17:11:32 2016 -0500
> # Branch stable
> # Node ID c5130abe229cbbb897e40e1bde607205b0b2213b
> # Parent  34057d996573b0fc273a6d86635f30389d055f2d
> bdiff: remove effectively dead code

Queued these for stable, thanks.

>
> Now that we extend matches backwards in the inner loop, the final
> adjustment has no effect.
>
> (A similar extension for the forward direction is trickier and has
> less benefit.)
>
> diff -r 34057d996573 -r c5130abe229c mercurial/bdiff.c
> --- a/mercurial/bdiff.c	Thu Jun 02 17:09:06 2016 -0500
> +++ b/mercurial/bdiff.c	Thu Jun 02 17:11:32 2016 -0500
> @@ -148,7 +148,7 @@
>  static int longest_match(struct line *a, struct line *b, struct pos *pos,
>                        int a1, int a2, int b1, int b2, int *omi, int *omj)
>  {
> -	int mi = a1, mj = b1, mk = 0, mb = 0, i, j, k, half;
> +	int mi = a1, mj = b1, mk = 0, i, j, k, half;
>
>       /* window our search on large regions to better bound
>          worst-case performance. by choosing a window at the end, we
> @@ -195,18 +195,15 @@
>               mj = mj - mk + 1;
>       }
>
> -	/* expand match to include neighboring popular lines */
> -	while (mi - mb > a1 && mj - mb > b1 &&
> -            a[mi - mb - 1].e == b[mj - mb - 1].e)
> -		mb++;
> +	/* expand match to include subsequent popular lines */
>       while (mi + mk < a2 && mj + mk < b2 &&
>              a[mi + mk].e == b[mj + mk].e)
>               mk++;
>
> -	*omi = mi - mb;
> -	*omj = mj - mb;
> +	*omi = mi;
> +	*omj = mj;
>
> -	return mk + mb;
> +	return mk;
>  }
>
>  static struct hunk *recurse(struct line *a, struct line *b, struct pos *pos,
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel


More information about the Mercurial-devel mailing list