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

Isaac Jurado diptongo at gmail.com
Mon Sep 10 15:41:58 CDT 2012


On Mon, Sep 10, 2012 at 10:35 PM, Bryan O'Sullivan <bos at serpentine.com> wrote:
>
> +static PyObject *hashencode(const char *src, Py_ssize_t len)
> +{
> +       const Py_ssize_t baselen = (len - 5) * 3;
> +#ifndef _MSC_VER
> +       /* alloca is surprisingly slow, so avoid with sane compilers */
> +       char dired[baselen];
> +       char lowered[baselen];
> +       char auxed[baselen];
> +#else
> +       char *dired = alloca(baselen);
> +       char *lowered = alloca(baselen);
> +       char *auxed = alloca(baselen);
> +#endif

Out of curiosity, is there an implicit upper bound for "len"?

-- 
Isaac Jurado

"The noblest pleasure is the joy of understanding"
Leonardo da Vinci


More information about the Mercurial-devel mailing list