Re: [PATCH v4] libgit-rs: add get_bool(), get_ulong(), and get_pathname() methods
- From
brian m. carlson <sandals@crustytoothpaste.net>
- Date
- Oct 6, 2025, 21:20 UTC
- Message-ID
- <aOQyioJChUkJOXRb@fruit.crustytoothpaste.net>
- In-Reply-To
- <0cb55558-a48e-42ac-a80e-a24ee2be55ee@gmail.com>
On 2025-10-01 at 10:15:28, Phillip Wood wrote:
Show 14 quoted lines
> [I've cc'd brian to sanity check my suggestion for handling c_ulong in rust
> 1.63 which lacks std::ffi::c_ulong]
>
> As I said before this wont work because C's ulong type is platform dependent
> so you cannot assume it 64 bits wide. Looking at the previous discussion[1]
> the reason we have these fallback definitions is because std::ffi::c_int etc
> were only added in rust 1.64 and we want to support rust 1.63 as that is the
> version shipped by Debian oldstable. I think it would be better to have a
> separate preparatory patch that changes the existing fallbacks to
>
> #[cfg(not(has_std__ff__c_char))]
> use std::os::raw::{c_char, c_int};
>
> and then this patch can add "c_ulong" to the list.It's just fine to use `std::os::raw` in general without needing to use `std::ffi` conditionally. I'd just default to that until we move away from Rust 1.63. That's what I do myself.
-- brian m. carlson (they/them) Toronto, Ontario, CA