Mercurial > hg
comparison mercurial/parsers.c @ 25311:d2e88f960d1a
parsers: move index_get_parents's declaration higher
index_get_parents needs to be used in the phase computation code so we need
to move its declaration higher to be able to call it. It cannot be moved any
higher than that so we won't have any more patch doing the same thing.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Wed, 27 May 2015 17:00:28 -0700 |
parents | 3966e39fea98 |
children | ee02728dd5f9 |
comparison
equal
deleted
inserted
replaced
25310:c1f5ef76d1c2 | 25311:d2e88f960d1a |
---|---|
739 } | 739 } |
740 | 740 |
741 return PyString_AS_STRING(self->data) + pos * v1_hdrsize; | 741 return PyString_AS_STRING(self->data) + pos * v1_hdrsize; |
742 } | 742 } |
743 | 743 |
744 static inline void index_get_parents(indexObject *self, Py_ssize_t rev, | |
745 int *ps) | |
746 { | |
747 if (rev >= self->length - 1) { | |
748 PyObject *tuple = PyList_GET_ITEM(self->added, | |
749 rev - self->length + 1); | |
750 ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5)); | |
751 ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6)); | |
752 } else { | |
753 const char *data = index_deref(self, rev); | |
754 ps[0] = getbe32(data + 24); | |
755 ps[1] = getbe32(data + 28); | |
756 } | |
757 } | |
758 | |
759 | |
744 /* | 760 /* |
745 * RevlogNG format (all in big endian, data may be inlined): | 761 * RevlogNG format (all in big endian, data may be inlined): |
746 * 6 bytes: offset | 762 * 6 bytes: offset |
747 * 2 bytes: flags | 763 * 2 bytes: flags |
748 * 4 bytes: compressed length | 764 * 4 bytes: compressed length |
1173 Py_XDECREF(phasessetlist); | 1189 Py_XDECREF(phasessetlist); |
1174 release_phases: | 1190 release_phases: |
1175 free(phases); | 1191 free(phases); |
1176 release_none: | 1192 release_none: |
1177 return ret; | 1193 return ret; |
1178 } | |
1179 | |
1180 static inline void index_get_parents(indexObject *self, Py_ssize_t rev, | |
1181 int *ps) | |
1182 { | |
1183 if (rev >= self->length - 1) { | |
1184 PyObject *tuple = PyList_GET_ITEM(self->added, | |
1185 rev - self->length + 1); | |
1186 ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5)); | |
1187 ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6)); | |
1188 } else { | |
1189 const char *data = index_deref(self, rev); | |
1190 ps[0] = getbe32(data + 24); | |
1191 ps[1] = getbe32(data + 28); | |
1192 } | |
1193 } | 1194 } |
1194 | 1195 |
1195 static PyObject *index_headrevs(indexObject *self, PyObject *args) | 1196 static PyObject *index_headrevs(indexObject *self, PyObject *args) |
1196 { | 1197 { |
1197 Py_ssize_t i, j, len; | 1198 Py_ssize_t i, j, len; |