Re: [PATCH 12/12] Optimize diff-tree -[CM] --stdin
- From
- Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
- Date
- Jun 4, 2005, 02:17 UTC
- Message-ID
- <20050604111755.50a34338.yuasa@hh.iij4u.or.jp>
- In-Reply-To
- <7vhdgo2s7t.fsf_-_@assigned-by-dhcp.cox.net>
Hi,
On Fri, 27 May 2005 15:56:38 -0700 Junio C Hamano <junkio@cox.net> wrote:
>
<snip>
Show 33 quoted lines
> diff --git a/diff.c b/diff.c
> --- a/diff.c
> +++ b/diff.c
> @@ -12,6 +12,7 @@ static const char *diff_opts = "-pu";
> static unsigned char null_sha1[20] = { 0, };
>
> static int reverse_diff;
> +static int use_size_cache;
>
> static const char *external_diff(void)
> {
> @@ -222,12 +223,60 @@ static int work_tree_matches(const char
> return 1;
> }
>
> +static struct sha1_size_cache {
> + unsigned char sha1[20];
> + unsigned long size;
> +} **sha1_size_cache;
> +static int sha1_size_cache_nr, sha1_size_cache_alloc;
> +
> +static struct sha1_size_cache *locate_size_cache(unsigned char *sha1,
> + unsigned long size)
> +{
> + int first, last;
> + struct sha1_size_cache *e;
> +
> + first = 0;
> + last = sha1_size_cache_nr;
> + while (last > first) {
> + int next = (last + first) >> 1;
> + e = sha1_size_cache[next];
> + int cmp = memcmp(e->sha1, sha1, 20);I got build error in diff.c Please apply the following patch.
Thanks,
Yoichi
Signed-off-by: Yoichi Yuasa <yuasa@hh.iij4u.or.jp>
diff --git a/diff.c b/diff.c --- a/diff.c +++ b/diff.c @@ -244,9 +244,9 @@ static struct sha1_size_cache *locate_si first = 0; last = sha1_size_cache_nr; while (last > first) { - int next = (last + first) >> 1; + int cmp, next = (last + first) >> 1; e = sha1_size_cache[next]; - int cmp = memcmp(e->sha1, sha1, 20); + cmp = memcmp(e->sha1, sha1, 20); if (!cmp) return e; if (cmp < 0) {