finish TODO actions
This commit is contained in:
parent
8b78930472
commit
5e1600277c
6 changed files with 9 additions and 37 deletions
24
TODO.md
24
TODO.md
|
|
@ -1,24 +0,0 @@
|
|||
- [ ] rename `AsInnerPtr::as_ptr` to `AsInnerPtr::as_mut_ptr`
|
||||
|
||||
- [ ] add NixError::from_nonnull that replaces calls to NonNull::new(...).ok_or(...)
|
||||
- [ ] replace all `use nixide_sys as sys;` -> `use crate::sys;`
|
||||
- [ ] store NonNull pointers in structs!
|
||||
- [ ] improve documentation situation on context.rs
|
||||
|
||||
- [ ] rename `as_ptr()` to `as_inner_ptr()` or `inner_ptr()`?
|
||||
- [ ] ^^^ this fn should be added to a trait (maybe just `trait NixStructWrapper : AsPtr { ... }`)
|
||||
- [ ] ^^^ also make `as_ptr()` public
|
||||
|
||||
- [ ] add mutexs and make the library thread safe!!
|
||||
|
||||
- [ ] grep all `self.inner.as_ptr()` calls and replace them with `self.as_ptr()`
|
||||
|
||||
|
||||
- [ ] `ErrorContext::peak` should return `Result<(), NixideError>` **not** `Option<NixideError>`
|
||||
- [ ] `self.expect_type` should instead be a macro to preserve the trace macro location
|
||||
|
||||
- [ ] make `Value` an enum instead because like duhh
|
||||
|
||||
- [ ] ensure we're always calling `ctx.peak()` unless it's ACTUALLY not necessary
|
||||
|
||||
- [ ] replace *most* calls to `ErrorContext::peak()` with `ErrorContext::pop()`
|
||||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue