# HG changeset patch # User Laurent Charignon # Date 2015-05-28 00:00:28 # Node ID d2e88f960d1ad1e1a72a0572272ded11d5d20b5d # Parent c1f5ef76d1c23e12dcbe89b4bb01e59dfbcc5578 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. diff --git a/mercurial/parsers.c b/mercurial/parsers.c --- a/mercurial/parsers.c +++ b/mercurial/parsers.c @@ -741,6 +741,22 @@ static const char *index_deref(indexObje return PyString_AS_STRING(self->data) + pos * v1_hdrsize; } +static inline void index_get_parents(indexObject *self, Py_ssize_t rev, + int *ps) +{ + if (rev >= self->length - 1) { + PyObject *tuple = PyList_GET_ITEM(self->added, + rev - self->length + 1); + ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5)); + ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6)); + } else { + const char *data = index_deref(self, rev); + ps[0] = getbe32(data + 24); + ps[1] = getbe32(data + 28); + } +} + + /* * RevlogNG format (all in big endian, data may be inlined): * 6 bytes: offset @@ -1177,21 +1193,6 @@ release_none: return ret; } -static inline void index_get_parents(indexObject *self, Py_ssize_t rev, - int *ps) -{ - if (rev >= self->length - 1) { - PyObject *tuple = PyList_GET_ITEM(self->added, - rev - self->length + 1); - ps[0] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 5)); - ps[1] = (int)PyInt_AS_LONG(PyTuple_GET_ITEM(tuple, 6)); - } else { - const char *data = index_deref(self, rev); - ps[0] = getbe32(data + 24); - ps[1] = getbe32(data + 28); - } -} - static PyObject *index_headrevs(indexObject *self, PyObject *args) { Py_ssize_t i, j, len;