[PATCH 5 of 5 v5] store: implement fncache hash encoding in C

Adrian Buehlmann adrian at cadifra.com
Fri Oct 5 13:01:53 CDT 2012


On 2012-09-10 22:35, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1347309263 25200
> # Node ID bd3831e77556a584bd581cd8ff7140e3404f6b68
> # Parent  c2cc9263d4969b22b4b9fd39f22e97c70fc700a2
> store: implement fncache hash encoding in C

[..]

> diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
> --- a/mercurial/pathencode.c
> +++ b/mercurial/pathencode.c

[..]

> +static Py_ssize_t auxencode(char *dest, size_t destsize,
> +			    const char *src, Py_ssize_t len)
> +{
> +	static const uint32_t twobytes[8];
> +
> +	static const uint32_t onebyte[8] = {
> +		~0, 0xffffbffe, ~0, ~0, ~0, ~0, ~0, ~0,
 should be:         0xffff3ffe

The bit for ASCII code 47 ('/') must *not* be set, to make sure '/' is
handled by the state machine, and not inside the while loop at

		case DEFAULT:
			while (inset(onebyte, src[i])) {
				charcopy(dest, &destlen, destsize, src[i++]);
				if (i == len)
					goto done;
			}


(just in case someone plans to recycle this, which might be me myself)

> +	};
> +
> +	return _encode(twobytes, onebyte, dest, 0, destsize, src, len, 0);
> +}
> +


More information about the Mercurial-devel mailing list