Mercurial > hg
diff mercurial/cext/revlog.c @ 44502:166349510398
revlog: using two new functions in C capsule from Rust code
We expose `index_length` and `index_node` in the C capsule, so that
the Rust representation of the C index can implement the `RevlogIndex`
trait.
Because our `Node` is actually a one-field struct, we have
to decorate it for direct FFI exchange with the C `char*`
It would be a good thing to get a length from the C layer, but doing
so right now would probably interfere with the upcoming changes that
will happen there for the hash length.
Differential Revision: https://phab.mercurial-scm.org/D8152
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Mon, 13 Jan 2020 19:31:33 +0100 |
parents | b55bec1ea972 |
children | f8427841c8fc |
line wrap: on
line diff
--- a/mercurial/cext/revlog.c Tue Feb 18 19:11:14 2020 +0100 +++ b/mercurial/cext/revlog.c Mon Jan 13 19:31:33 2020 +0100 @@ -39,6 +39,8 @@ typedef struct { int abi_version; + Py_ssize_t (*index_length)(const indexObject *); + const char *(*index_node)(indexObject *, Py_ssize_t); int (*index_parents)(PyObject *, int, int *); } Revlog_CAPI; @@ -2877,7 +2879,9 @@ static Revlog_CAPI CAPI = { /* increment the abi_version field upon each change in the Revlog_CAPI struct or in the ABI of the listed functions */ - 1, + 2, + index_length, + index_node, HgRevlogIndex_GetParents, };