From 31ecc5e0f9a903827600112008c18c4e1cf9a684 Mon Sep 17 00:00:00 2001 From: Johannes Altmanninger Date: Sun, 3 Dec 2023 11:34:11 +0100 Subject: [PATCH] compat.rs: group declarations --- fish-rust/src/compat.rs | 30 ++++++++++++++++++------------ fish-rust/src/lib.rs | 1 + 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/fish-rust/src/compat.rs b/fish-rust/src/compat.rs index 117539d0a..07e2a4ffd 100644 --- a/fish-rust/src/compat.rs +++ b/fish-rust/src/compat.rs @@ -3,44 +3,50 @@ use std::sync::atomic::AtomicPtr; use libc::c_int; use once_cell::sync::Lazy; -#[allow(non_snake_case)] pub fn MB_CUR_MAX() -> usize { unsafe { C_MB_CUR_MAX() } } +extern "C" { + fn C_MB_CUR_MAX() -> usize; +} -#[allow(non_snake_case)] pub fn ST_LOCAL() -> u64 { unsafe { C_ST_LOCAL() } } +extern "C" { + fn C_ST_LOCAL() -> u64; +} -#[allow(non_snake_case)] pub fn MNT_LOCAL() -> u64 { unsafe { C_MNT_LOCAL() } } +extern "C" { + fn C_MNT_LOCAL() -> u64; +} -#[allow(non_snake_case)] pub fn _CS_PATH() -> i32 { unsafe { C_CS_PATH() } } +extern "C" { + fn C_CS_PATH() -> i32; +} -#[allow(non_snake_case)] pub static _PATH_BSHELL: AtomicPtr = AtomicPtr::new(std::ptr::null_mut()); +extern "C" { + pub fn C_PATH_BSHELL() -> *const i8; +} -#[allow(non_snake_case)] pub static _PC_CASE_SENSITIVE: Lazy = Lazy::new(|| unsafe { C_PC_CASE_SENSITIVE() }); +extern "C" { + fn C_PC_CASE_SENSITIVE() -> c_int; +} extern "C" { - fn C_MB_CUR_MAX() -> usize; - fn C_ST_LOCAL() -> u64; - fn C_MNT_LOCAL() -> u64; - fn C_CS_PATH() -> i32; pub(crate) fn confstr( name: libc::c_int, buf: *mut libc::c_char, len: libc::size_t, ) -> libc::size_t; - pub fn C_PATH_BSHELL() -> *const i8; - fn C_PC_CASE_SENSITIVE() -> c_int; pub fn C_O_EXLOCK() -> c_int; pub fn stdout_stream() -> *mut libc::FILE; pub fn UVAR_FILE_SET_MTIME_HACK() -> bool; diff --git a/fish-rust/src/lib.rs b/fish-rust/src/lib.rs index e90083cea..6fd3957c8 100644 --- a/fish-rust/src/lib.rs +++ b/fish-rust/src/lib.rs @@ -32,6 +32,7 @@ mod ast; mod autoload; mod builtins; mod color; +#[allow(non_snake_case)] mod compat; mod complete; mod curses;