##// END OF EJS Templates
reachableroots: extend "revstates" to array of bit flags
Yuya Nishihara -
r26044:b3ad349d default
parent child Browse files
Show More
@@ -1130,9 +1130,10 b' static PyObject *reachableroots(indexObj'
1130
1130
1131 /* Internal data structure:
1131 /* Internal data structure:
1132 * tovisit: array of length len+1 (all revs + nullrev), filled upto lentovisit
1132 * tovisit: array of length len+1 (all revs + nullrev), filled upto lentovisit
1133 * revstates: array of length len+1 (all revs + nullrev) 0: not seen, 1 seen*/
1133 * revstates: array of length len+1 (all revs + nullrev) */
1134 int *tovisit = NULL;
1134 int *tovisit = NULL;
1135 long lentovisit = 0;
1135 long lentovisit = 0;
1136 enum { RS_SEEN = 1 };
1136 char *revstates = NULL;
1137 char *revstates = NULL;
1137
1138
1138 /* Get arguments */
1139 /* Get arguments */
@@ -1173,9 +1174,9 b' static PyObject *reachableroots(indexObj'
1173 PyErr_SetString(PyExc_IndexError, "head out of range");
1174 PyErr_SetString(PyExc_IndexError, "head out of range");
1174 goto bail;
1175 goto bail;
1175 }
1176 }
1176 if (revstates[revnum+1] == 0) {
1177 if (!(revstates[revnum + 1] & RS_SEEN)) {
1177 tovisit[lentovisit++] = revnum;
1178 tovisit[lentovisit++] = revnum;
1178 revstates[revnum+1]=1;
1179 revstates[revnum + 1] |= RS_SEEN;
1179 }
1180 }
1180 }
1181 }
1181
1182
@@ -1203,10 +1204,10 b' static PyObject *reachableroots(indexObj'
1203 if (r < 0)
1204 if (r < 0)
1204 goto bail;
1205 goto bail;
1205 for (i = 0; i < 2; i++) {
1206 for (i = 0; i < 2; i++) {
1206 if (revstates[parents[i] + 1] == 0
1207 if (!(revstates[parents[i] + 1] & RS_SEEN)
1207 && parents[i] >= minroot) {
1208 && parents[i] >= minroot) {
1208 tovisit[lentovisit++] = parents[i];
1209 tovisit[lentovisit++] = parents[i];
1209 revstates[parents[i] + 1] = 1;
1210 revstates[parents[i] + 1] |= RS_SEEN;
1210 }
1211 }
1211 }
1212 }
1212 }
1213 }
@@ -1218,7 +1219,7 b' static PyObject *reachableroots(indexObj'
1218 if (minidx < 0)
1219 if (minidx < 0)
1219 minidx = 0;
1220 minidx = 0;
1220 for (i = minidx; i < len; i++) {
1221 for (i = minidx; i < len; i++) {
1221 if (revstates[i + 1] != 1)
1222 if (!(revstates[i + 1] & RS_SEEN))
1222 continue;
1223 continue;
1223 r = index_get_parents(self, i, parents, (int)len - 1);
1224 r = index_get_parents(self, i, parents, (int)len - 1);
1224 /* Corrupted index file, error is set from
1225 /* Corrupted index file, error is set from
General Comments 0
You need to be logged in to leave comments. Login now