[PATCH 1 of 2] bdiff: extract line record finalization to a macro

Yuya Nishihara yuya at tcha.org
Sun Nov 20 05:35:53 EST 2016


On Sat, 12 Nov 2016 19:44:48 -0800, Gregory Szorc wrote:
> # HG changeset patch
> # User Gregory Szorc <gregory.szorc at gmail.com>
> # Date 1479000183 28800
> #      Sat Nov 12 17:23:03 2016 -0800
> # Node ID 99388e747e8f99c7bdcfd2592ed8fc45e885ee55
> # Parent  74918cd12b496ab6c975c05a202b334e07ef33c3
> bdiff: extract line record finalization to a macro

LGTM, one nit.

> --- a/mercurial/bdiff.c
> +++ b/mercurial/bdiff.c
> @@ -21,6 +21,16 @@
>  #define ROL(v, n) ((v) << (n) | (v) >> (sizeof(v) * CHAR_BIT - (n)))
>  #define HASH(h, c) ((c) + ROL(h ,7))
>  
> +#define FINALIZELINE(l, hash, p, b) { \
> +	l->hash = hash; \
> +	hash = 0; \
> +	l->len = p - b + 1; \
> +	l->l = b; \
> +	l->n = INT_MAX; \
> +	l++; \
> +	b = p + 1; \
> +}

Both sides of "l->l" are expanded to the argument "l". "l->hash = hash" has
the same issue.


More information about the Mercurial-devel mailing list