##// 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,16 +1197,16 b' 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 r = index_get_parents(self, revnum, parents, (int)len - 1);
1201 continue;
1202 if (r < 0)
1202 r = index_get_parents(self, revnum, parents, (int)len - 1);
1203 goto bail;
1203 if (r < 0)
1204
1204 goto bail;
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 tovisit[lentovisit++] = parents[i];
1207 && parents[i] >= minroot) {
1208 seen[parents[i] + 1] = 1;
1208 tovisit[lentovisit++] = parents[i];
1209 }
1209 seen[parents[i] + 1] = 1;
1210 }
1210 }
1211 }
1211 }
1212 }
1212 }
@@ -1218,24 +1218,25 b' 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 r = index_get_parents(self, i, parents, (int)len - 1);
1222 continue;
1223 /* Corrupted index file, error is set from index_get_parents */
1223 r = index_get_parents(self, i, parents, (int)len - 1);
1224 if (r < 0)
1224 /* Corrupted index file, error is set from
1225 * index_get_parents */
1226 if (r < 0)
1227 goto bail;
1228 for (k = 0; k < 2; k++) {
1229 PyObject *p = PyInt_FromLong(parents[k]);
1230 if (p == NULL)
1225 goto bail;
1231 goto bail;
1226 for (k = 0; k < 2; k++) {
1232 if (PySet_Contains(reachable, p) == 1) {
1227 PyObject *p = PyInt_FromLong(parents[k]);
1233 val = PyInt_FromLong(i);
1228 if (p == NULL)
1234 if (val == NULL)
1229 goto bail;
1235 goto bail;
1230 if (PySet_Contains(reachable, p) == 1) {
1236 PySet_Add(reachable, val);
1231 val = PyInt_FromLong(i);
1237 Py_DECREF(val);
1232 if (val == NULL)
1233 goto bail;
1234 PySet_Add(reachable, val);
1235 Py_DECREF(val);
1236 }
1237 Py_DECREF(p);
1238 }
1238 }
1239 Py_DECREF(p);
1239 }
1240 }
1240 }
1241 }
1241 }
1242 }
General Comments 0
You need to be logged in to leave comments. Login now