[PATCH 1 of 3 v4] store: implement fncache path mangling code in C

Adrian Buehlmann adrian at cadifra.com
Thu Sep 6 18:54:00 CDT 2012


On 2012-09-07 01:31, Bryan O'Sullivan wrote:
> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1346971115 25200
> # Node ID 831e86e4a9e9621c32c9c3fd314790d7a0276f22
> # Parent  c11d7eac6ee384f8b3e7d0f005cd2556d2d0b29c
> store: implement fncache path mangling code in C

[..]

> diff --git a/mercurial/pathencode.c b/mercurial/pathencode.c
> new file mode 100644
> --- /dev/null
> +++ b/mercurial/pathencode.c
> @@ -0,0 +1,686 @@
> +/*
> + pathencode.c - efficient path name encoding
> +
> + Copyright 2012 Facebook
> +
> + This software may be used and distributed according to the terms of
> + the GNU General Public License, incorporated herein by reference.
> +*/
> +
> +/*
> + * An implementation of the name encoding scheme used by the fncache
> + * store.  The common case is of a path < 120 bytes long, which is
> + * handled either in a single pass with no allocations or two passes
> + * with a single allocation.  For longer paths, multiple passes are
> + * required.
> + */
> +
> +#include <Python.h>
> +#include <assert.h>
> +#include <ctype.h>
> +#include <stdint.h>
> +#include <stdlib.h>
> +#include <string.h>

I needed something like

#include <Python.h>
#include <assert.h>
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
#include <malloc.h>

#ifndef _MSC_VER
#include <stdint.h>
#else
#define inline __inline
typedef unsigned char uint8_t;
typedef unsigned __int32 uint32_t;
#endif

when I tried the V2 patch with MS C

> +
> +/* state machine for the fast path */
> +enum path_state {


More information about the Mercurial-devel mailing list