[PATCH] V2 of experiment for a simpler path encoding for hashed paths (for "fncache2")
Adrian Buehlmann
adrian at cadifra.com
Tue Sep 25 10:35:53 CDT 2012
On 2012-09-25 14:53, Adrian Buehlmann wrote:
> diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
> --- a/mercurial/pathencode.c
> +++ b/mercurial/pathencode.c
> @@ -479,8 +479,104 @@
> src, len, 1);
> }
>
> +static char encchar[128] = "~abcdefghijklmnopqrstuvwxyz{~}~~"
> + " !\"#$%&'()~+,-.~0123456789~;~=~~"
> + "@abcdefghijklmnopqrstuvwxyz[~]^_"
> + "`abcdefghijklmnopqrstuvwxyz{~}~~";
> +
> +/* this encoding folds */
> +static inline char encodechar(char c)
> +{
> + return c ? encchar[0x7f & c] : 0;
> +}
> +
> static const Py_ssize_t maxstorepathlen = 120;
>
This can be further simplified by using string token "\0", and inserting
a const probably makes sense there (passes unit tests):
static const char encchar[128] =
"\0abcdefghijklmnopqrstuvwxyz{~}~~"
" !\"#$%&'()~+,-.~0123456789~;~=~~"
"@abcdefghijklmnopqrstuvwxyz[~]^_"
"`abcdefghijklmnopqrstuvwxyz{~}~~";
/* this encoding folds */
static inline char encodechar(char c)
{
return encchar[0x7f & c];
}
More information about the Mercurial-devel
mailing list