[PATCH 3 of 4 warning-cleanup] parsers: avoid int/unsigned conversions

Yuya Nishihara yuya at tcha.org
Sat Aug 22 06:32:50 CDT 2015


On Fri, 21 Aug 2015 14:36:11 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1440182031 14400
> #      Fri Aug 21 14:33:51 2015 -0400
> # Node ID c94fce4d889c4f83b6d62bd8a2d4550aa0fb91f0
> # Parent  f9f6192f329048b537dc2dc2af18f98479fe4388
> parsers: avoid int/unsigned conversions
> 
> Detected with
> make local CFLAGS='-Wall -Wextra -Wno-missing-field-initializers -Wno-unused-parameter' CC=clang
> 
> diff --git a/mercurial/parsers.c b/mercurial/parsers.c
> --- a/mercurial/parsers.c
> +++ b/mercurial/parsers.c
> @@ -705,8 +705,8 @@ typedef struct {
>  	PyObject *headrevs;    /* cache, invalidated on changes */
>  	PyObject *filteredrevs;/* filtered revs set */
>  	nodetree *nt;          /* base-16 trie */
> -	int ntlength;          /* # nodes in use */
> -	int ntcapacity;        /* # nodes allocated */
> +	unsigned ntlength;          /* # nodes in use */
> +	unsigned ntcapacity;        /* # nodes allocated */
>  	int ntdepth;           /* maximum depth of tree */
>  	int ntsplits;          /* # splits performed */
>  	int ntrev;             /* last rev scanned */

It seems odd to me because all other sizes in indexObject are signed.
But, it's just a matter of taste.


More information about the Mercurial-devel mailing list