finish TODO actions

This commit is contained in:
do butterflies cry? 2026-03-26 12:00:39 +10:00
parent 8b78930472
commit 5e1600277c
Signed by: cry
GPG key ID: F68745A836CA0412
6 changed files with 9 additions and 37 deletions

View file

@ -182,8 +182,6 @@ impl ErrorContext {
/// of `nix_c_context` must be careful to check the `last_err_code` regularly.
pub fn clear(&mut self) {
unsafe {
// NOTE: previous nixops4 used the line: (maybe for compatability with old versions?)
// sys::nix_set_err_msg(self.inner.as_ptr(), sys::nix_err_NIX_OK, c"".as_ptr());
sys::nix_clear_err(self.as_ptr());
}
}
@ -351,7 +349,7 @@ impl ErrorContext {
impl Drop for ErrorContext {
fn drop(&mut self) {
unsafe {
sys::nix_c_context_free(self.inner.as_ptr());
sys::nix_c_context_free(self.as_ptr());
}
}
}

View file

@ -97,9 +97,8 @@ impl EvalState {
impl Drop for EvalState {
fn drop(&mut self) {
// SAFETY: We own the state and it's valid until drop
unsafe {
sys::nix_state_free(self.inner.as_ptr());
sys::nix_state_free(self.as_ptr());
}
}
}

View file

@ -77,9 +77,8 @@ impl EvalStateBuilder {
impl Drop for EvalStateBuilder {
fn drop(&mut self) {
// SAFETY: We own the builder and it's valid until drop
unsafe {
sys::nix_eval_state_builder_free(self.inner.as_ptr());
sys::nix_eval_state_builder_free(self.as_ptr());
}
}
}

View file

@ -129,7 +129,7 @@ impl Store {
sys::nix_store_realise(
ctx.as_ptr(),
self.inner.as_ptr(),
self.as_ptr(),
path.as_ptr(),
(*state).inner_ptr() as *mut c_void,
Some(callback),
@ -173,7 +173,7 @@ impl Store {
|callback, userdata: *mut __UserData, ctx: &ErrorContext| unsafe {
sys::nix_store_get_version(
ctx.as_ptr(),
self.inner.as_ptr(),
self.as_ptr(),
Some(callback),
userdata as *mut c_void,
)
@ -187,7 +187,7 @@ impl Store {
|callback, userdata: *mut __UserData, ctx: &ErrorContext| unsafe {
sys::nix_store_get_uri(
ctx.as_ptr(),
self.inner.as_ptr(),
self.as_ptr(),
Some(callback),
userdata as *mut c_void,
)
@ -200,7 +200,7 @@ impl Store {
|callback, userdata: *mut __UserData, ctx: &ErrorContext| unsafe {
sys::nix_store_get_storedir(
ctx.as_ptr(),
self.inner.as_ptr(),
self.as_ptr(),
Some(callback),
userdata as *mut c_void,
)
@ -242,7 +242,7 @@ impl Store {
impl Drop for Store {
fn drop(&mut self) {
unsafe {
sys::nix_store_free(self.inner.as_ptr());
sys::nix_store_free(self.as_ptr());
}
}
}

View file

@ -71,7 +71,7 @@ impl StorePath {
///
pub fn name(&self) -> NixideResult<String> {
wrap::nix_string_callback!(|callback, userdata: *mut __UserData, _| unsafe {
sys::nix_store_path_name(self.inner.as_ptr(), Some(callback), userdata as *mut c_void);
sys::nix_store_path_name(self.as_ptr(), Some(callback), userdata as *mut c_void);
// NOTE: nix_store_path_name doesn't return nix_err, so we force it to return successfully
// XXX: NOTE: now `nix_string_callback` is a macro this isn't necessary
// sys::nix_err_NIX_OK