Mercurial > hg
diff mercurial/parsers.c @ 25280:8c8af4d8aca3
changelog: move index_get_parents function up
index_get_parents can be used in index_headrevs, to do so it needs to be moved
up in the compilation unit.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 21 May 2015 15:44:38 -0700 |
parents | 22438cfd11b5 |
children | 260fb5968de0 |
line wrap: on
line diff
--- a/mercurial/parsers.c Tue May 26 22:58:30 2015 +0800 +++ b/mercurial/parsers.c Thu May 21 15:44:38 2015 -0700 @@ -1177,6 +1177,20 @@ return ret; } +static inline void index_get_parents(indexObject *self, int 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, len, addlen; @@ -1690,20 +1704,6 @@ } } -static inline void index_get_parents(indexObject *self, int 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); - } -} - typedef uint64_t bitmask; /*