Re: [PATCH 4/7] xdiff: make fields of xrecord_t Rust friendly
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Jul 17, 2025, 22:46 UTC
- Message-ID
- <aHl9YLc823uWwgIp@nand.local>
- In-Reply-To
- <6df9f50a8f4ca29b2c3ba1e39982b6d516146bb3.1752784344.git.gitgitgadget@gmail.com>
On Thu, Jul 17, 2025 at 08:32:21PM +0000, Ezekiel Newren via GitGitGadget wrote:
Show 6 quoted lines
> From: Ezekiel Newren <ezekielnewren@gmail.com> > > A few commits ago, we added definitions for Rust primitive types, > to facilitate interoperability between C and Rust. Switch a > few variables to use these types. Which, for now, will > require adding some casts.
Hmm, interesting. I am not super familiar with how people typically handle interoperability between C and Rust, but having to change types on the C side to make it work with Rust is a bit surprising to me.
I would have expected that the Rust side would have declared its types using libc::c_int, libc::size_t, and so on. I think I have a vague preference towards putting the burden of casting on the Rust side, but, again, I am not super familiar with how transitions like these are typically approached.
Show 9 quoted lines
> --- > xdiff/xdiffi.c | 8 ++++---- > xdiff/xemit.c | 2 +- > xdiff/xmerge.c | 14 +++++++------- > xdiff/xpatience.c | 2 +- > xdiff/xprepare.c | 6 +++--- > xdiff/xtypes.h | 6 +++--- > xdiff/xutils.c | 4 ++-- > 7 files changed, 21 insertions(+), 21 deletions(-)
The rest of the patch looks good to me, assuming that the burden of casting is placed on the C side.
Thanks, Taylor