rust: fix signature of rustlazyancestors_init() function stable 4.8
authorYuya Nishihara <yuya@tcha.org>
Sun, 28 Oct 2018 21:16:36 +0900
branchstable
changeset 40454 a91a2837150b
parent 40453 1bf3e6041e2c
child 40458 8de8d4b0781c
rust: fix signature of rustlazyancestors_init() function Obviously, sizeof(int) != mem::size_of::<usize>() on amd64, though the argument would be passed in 64-bit register anyway.
mercurial/cext/revlog.c
rust/hg-direct-ffi/src/ancestors.rs
--- a/mercurial/cext/revlog.c	Fri Nov 02 21:25:35 2018 +0900
+++ b/mercurial/cext/revlog.c	Sun Oct 28 21:16:36 2018 +0900
@@ -2311,7 +2311,7 @@
 	/* 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);
--- a/rust/hg-direct-ffi/src/ancestors.rs	Fri Nov 02 21:25:35 2018 +0900
+++ b/rust/hg-direct-ffi/src/ancestors.rs	Sun Oct 28 21:16:36 2018 +0900
@@ -60,15 +60,16 @@
 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<Index> {
+    assert!(initrevslen >= 0);
     unsafe {
         raw_init(
             Index::new(index, parents),
-            initrevslen,
+            initrevslen as usize,
             initrevs,
             stoprev,
             inclusive,