[PATCH V3] parsers.c: avoid implicit conversion loses integer precision warnings
Yuya Nishihara
yuya at tcha.org
Wed Aug 19 07:45:37 CDT 2015
On Tue, 18 Aug 2015 20:52:38 +0200, André Sintzoff wrote:
> # HG changeset patch
> # User André Sintzoff <andre.sintzoff at gmail.com>
> # Date 1439902654 -7200
> # Tue Aug 18 14:57:34 2015 +0200
> # Node ID ae1dbf8a309b47660abbce73b4a7351518ffe433
> # Parent 9e7d805925c87cfa0ca30819e8273ac37fd77a62
> parsers.c: avoid implicit conversion loses integer precision warnings
>
> These warnings are raised by Apple LLVM version 6.1.0 (clang-602.0.53)
> (based on LLVM 3.6.0svn) and were introduced in ff89383a97db
>
> diff -r 9e7d805925c8 -r ae1dbf8a309b mercurial/parsers.c
> --- a/mercurial/parsers.c Fri Aug 14 12:36:41 2015 +0900
> +++ b/mercurial/parsers.c Tue Aug 18 14:57:34 2015 +0200
> @@ -1125,13 +1125,13 @@
> Py_ssize_t k;
> Py_ssize_t i;
> int r;
> - int minidx;
> + long minidx;
> int parents[2];
>
> /* Internal data structure:
> * tovisit: array of length len+1 (all revs + nullrev), filled upto lentovisit
> * seen: array of length len+1 (all revs + nullrev) 0: not seen, 1 seen*/
> - int *tovisit = NULL;
> + long *tovisit = NULL;
> long lentovisit = 0;
> char *seen = NULL;
>
> @@ -1151,7 +1151,7 @@
> }
>
> /* Initialize internal datastructures */
> - tovisit = (int *)malloc((len + 1) * sizeof(int));
> + tovisit = (long *)malloc((len + 1) * sizeof(long));
This doubles the size of big tovisit array. tovisit can be an array of int
because it only keeps valid revisions.
More information about the Mercurial-devel
mailing list