##// END OF EJS Templates
reachableroots: reduce nesting level by jumping to next iteration by continue...
Yuya Nishihara -
r26041:8da628be default
parent child Browse files
Show More
@@ -1197,19 +1197,19 static PyObject *reachableroots(indexObj
1197 Py_DECREF(val);
1197 Py_DECREF(val);
1198
1198
1199 /* Add its parents to the list of nodes to visit */
1199 /* Add its parents to the list of nodes to visit */
1200 if (revnum != -1) {
1200 if (revnum == -1)
1201 continue;
1201 r = index_get_parents(self, revnum, parents, (int)len - 1);
1202 r = index_get_parents(self, revnum, parents, (int)len - 1);
1202 if (r < 0)
1203 if (r < 0)
1203 goto bail;
1204 goto bail;
1204
1205 for (i = 0; i < 2; i++) {
1205 for (i = 0; i < 2; i++) {
1206 if (seen[parents[i] + 1] == 0 && parents[i] >= minroot) {
1206 if (seen[parents[i] + 1] == 0
1207 && parents[i] >= minroot) {
1207 tovisit[lentovisit++] = parents[i];
1208 tovisit[lentovisit++] = parents[i];
1208 seen[parents[i] + 1] = 1;
1209 seen[parents[i] + 1] = 1;
1209 }
1210 }
1210 }
1211 }
1211 }
1212 }
1212 }
1213
1213
1214 /* Find all the nodes in between the roots we found and the heads
1214 /* Find all the nodes in between the roots we found and the heads
1215 * and add them to the reachable set */
1215 * and add them to the reachable set */
@@ -1218,9 +1218,11 static PyObject *reachableroots(indexObj
1218 if (minidx < 0)
1218 if (minidx < 0)
1219 minidx = 0;
1219 minidx = 0;
1220 for (i = minidx; i < len; i++) {
1220 for (i = minidx; i < len; i++) {
1221 if (seen[i + 1] == 1) {
1221 if (seen[i + 1] != 1)
1222 continue;
1222 r = index_get_parents(self, i, parents, (int)len - 1);
1223 r = index_get_parents(self, i, parents, (int)len - 1);
1223 /* Corrupted index file, error is set from index_get_parents */
1224 /* Corrupted index file, error is set from
1225 * index_get_parents */
1224 if (r < 0)
1226 if (r < 0)
1225 goto bail;
1227 goto bail;
1226 for (k = 0; k < 2; k++) {
1228 for (k = 0; k < 2; k++) {
@@ -1238,7 +1240,6 static PyObject *reachableroots(indexObj
1238 }
1240 }
1239 }
1241 }
1240 }
1242 }
1241 }
1242
1243
1243 free(seen);
1244 free(seen);
1244 free(tovisit);
1245 free(tovisit);
General Comments 0
You need to be logged in to leave comments. Login now