[PATCH] parsers: use char instead of int8_t

Adrian Buehlmann adrian at cadifra.com
Thu Sep 12 02:16:23 CDT 2013


On 2013-09-12 08:35, elson.wei at gmail.com wrote:
> # HG changeset patch
> # User Wei, Elson <elson.wei at gmail.com>
> # Date 1378967736 -28800
> #      Thu Sep 12 14:35:36 2013 +0800
> # Node ID 323830f2c65ece0e6111aae2b11d219d23b68d12
> # Parent  d69e06724b96a985f29fd493a5dfe356a75af387
> parsers: use char instead of int8_t
> 
> MS Windows SDK v7.0 doesn't have stdint.h in which int8_t is defined.
> For compatibility, changes the type of "hextable" back to char[].
> 
> diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -14,7 +14,7 @@
>  
>  #include "util.h"
>  
> -static int8_t hextable[256] = {
> +static char hextable[256] = {
>  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
>  	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
> @@ -35,7 +35,7 @@
>  
>  static inline int hexdigit(const char *p, Py_ssize_t off)
>  {
> -	int8_t val = hextable[(unsigned char)p[off]];
> +	char val = hextable[(unsigned char)p[off]];
>  
>  	if (val >= 0) {
>  		return val;

Perhaps, this could be resolved by adding a typedef for int8_t to
util.h, where we already have uint8_t (line 124).


More information about the Mercurial-devel mailing list