From 545a23734efedd70852c4ab3e0054023687bd57e Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Fri, 24 Jan 2025 16:24:08 +0100 Subject: [PATCH] Remove some ffi wrappers --- src/env/mod.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/env/mod.rs b/src/env/mod.rs index 3f7f7213a..43bf12eda 100644 --- a/src/env/mod.rs +++ b/src/env/mod.rs @@ -26,17 +26,6 @@ static SETENV_LOCK: Mutex<()> = Mutex::new(()); -mod ffi { - extern "C" { - pub fn setenv( - name: *const libc::c_char, - value: *const libc::c_char, - overwrite: libc::c_int, - ); - pub fn unsetenv(name: *const libc::c_char); - } -} - /// Sets an environment variable after obtaining a lock, to try and improve the safety of /// environment variables. /// @@ -47,7 +36,7 @@ pub fn setenv_lock(name: S1, value: S2, overwrite: let value = value.to_cstring(); let _lock = SETENV_LOCK.lock(); unsafe { - self::ffi::setenv(name.as_ptr(), value.as_ptr(), libc::c_int::from(overwrite)); + libc::setenv(name.as_ptr(), value.as_ptr(), libc::c_int::from(overwrite)); } } @@ -57,6 +46,6 @@ pub fn unsetenv_lock(name: S) { let name = name.to_cstring(); let _lock = SETENV_LOCK.lock(); unsafe { - self::ffi::unsetenv(name.as_ptr()); + libc::unsetenv(name.as_ptr()); } }