Mercurial > hg
comparison mercurial/parsers.c @ 26080:83c9edcac05c
reachableroots: silence warning of implicit integer narrowing issued by clang
Tested with CFLAGS=-Wshorten-64-to-32 CC=clang which is the default of
Mac OS X.
Because a valid revnum shouldn't exceed INT_MAX, we don't need long width for
large tovisit array.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Fri, 14 Aug 2015 12:25:14 +0900 |
parents | cefd5c8bab5d |
children | ce26928cbe41 |
comparison
equal
deleted
inserted
replaced
26079:cefd5c8bab5d | 26080:83c9edcac05c |
---|---|
1185 if (revnum + 1 < 0 || revnum + 1 >= len + 1) { | 1185 if (revnum + 1 < 0 || revnum + 1 >= len + 1) { |
1186 PyErr_SetString(PyExc_IndexError, "head out of range"); | 1186 PyErr_SetString(PyExc_IndexError, "head out of range"); |
1187 goto bail; | 1187 goto bail; |
1188 } | 1188 } |
1189 if (!(revstates[revnum + 1] & RS_SEEN)) { | 1189 if (!(revstates[revnum + 1] & RS_SEEN)) { |
1190 tovisit[lentovisit++] = revnum; | 1190 tovisit[lentovisit++] = (int)revnum; |
1191 revstates[revnum + 1] |= RS_SEEN; | 1191 revstates[revnum + 1] |= RS_SEEN; |
1192 } | 1192 } |
1193 } | 1193 } |
1194 | 1194 |
1195 /* Visit the tovisit list and find the reachable roots */ | 1195 /* Visit the tovisit list and find the reachable roots */ |
1226 } | 1226 } |
1227 | 1227 |
1228 /* Find all the nodes in between the roots we found and the heads | 1228 /* Find all the nodes in between the roots we found and the heads |
1229 * and add them to the reachable set */ | 1229 * and add them to the reachable set */ |
1230 if (includepath == 1) { | 1230 if (includepath == 1) { |
1231 int minidx = minroot; | 1231 long minidx = minroot; |
1232 if (minidx < 0) | 1232 if (minidx < 0) |
1233 minidx = 0; | 1233 minidx = 0; |
1234 for (i = minidx; i < len; i++) { | 1234 for (i = minidx; i < len; i++) { |
1235 if (!(revstates[i + 1] & RS_SEEN)) | 1235 if (!(revstates[i + 1] & RS_SEEN)) |
1236 continue; | 1236 continue; |