# HG changeset patch # User Yuya Nishihara # Date 2018-10-28 12:16:36 # Node ID a91a2837150bdcb27ae76b3646e6c93cd6a15904 # Parent 1bf3e6041e2c682ea1ba717a9bb8901172ba1bb8 rust: fix signature of rustlazyancestors_init() function Obviously, sizeof(int) != mem::size_of::() on amd64, though the argument would be passed in 64-bit register anyway. diff --git a/mercurial/cext/revlog.c b/mercurial/cext/revlog.c --- a/mercurial/cext/revlog.c +++ b/mercurial/cext/revlog.c @@ -2311,7 +2311,7 @@ rustlazyancestorsObject *rustlazyancesto /* to pass index_get_parents() */ int (*)(indexObject *, Py_ssize_t, int*, int), /* intrevs vector */ - int initrevslen, long *initrevs, + Py_ssize_t initrevslen, long *initrevs, long stoprev, int inclusive); void rustlazyancestors_drop(rustlazyancestorsObject *self); diff --git a/rust/hg-direct-ffi/src/ancestors.rs b/rust/hg-direct-ffi/src/ancestors.rs --- a/rust/hg-direct-ffi/src/ancestors.rs +++ b/rust/hg-direct-ffi/src/ancestors.rs @@ -60,15 +60,16 @@ impl Graph for Index { pub extern "C" fn rustlazyancestors_init( index: IndexPtr, parents: IndexParentsFn, - initrevslen: usize, + initrevslen: ssize_t, initrevs: *mut c_long, stoprev: c_long, inclusive: c_int, ) -> *mut AncestorsIterator { + assert!(initrevslen >= 0); unsafe { raw_init( Index::new(index, parents), - initrevslen, + initrevslen as usize, initrevs, stoprev, inclusive,