diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-29 14:16:30 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-29 17:41:26 +0100 |
commit | e5f3ae121f39b46cbc0416acb4ba7049f40203d2 (patch) | |
tree | 96b9c4881271006f76e8e3f6ff90cfe2335e8d20 /ffi/src | |
parent | 442740975e41208c1cad300bc023ddedb04fc3a6 (diff) |
openpgp-ffi: Convert Error.
Diffstat (limited to 'ffi/src')
-rw-r--r-- | ffi/src/core.rs | 11 | ||||
-rw-r--r-- | ffi/src/error.rs | 2 |
2 files changed, 7 insertions, 6 deletions
diff --git a/ffi/src/core.rs b/ffi/src/core.rs index f644dc4b..12ff469d 100644 --- a/ffi/src/core.rs +++ b/ffi/src/core.rs @@ -38,7 +38,6 @@ //! sq_context_free (ctx); //! ``` -use failure; use std::ptr; use libc::{uint8_t, c_char, c_int}; @@ -49,7 +48,7 @@ use sequoia_core::Config; #[doc(hidden)] pub struct Context { pub(crate) c: core::Context, - e: *mut failure::Error, + e: *mut ::error::Error, } impl Context { @@ -57,7 +56,7 @@ impl Context { Context{c: c, e: ptr::null_mut()} } - pub(crate) fn errp(&mut self) -> &mut *mut failure::Error { + pub(crate) fn errp(&mut self) -> &mut *mut ::error::Error { &mut self.e } } @@ -67,7 +66,7 @@ impl Context { /// Returns and removes the last error from the context. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn sq_context_last_error(ctx: *mut Context) - -> *mut failure::Error { + -> *mut ::error::Error { let ctx = ffi_param_ref_mut!(ctx); ::std::mem::replace(&mut ctx.e, ptr::null_mut()) } @@ -82,7 +81,7 @@ pub extern "system" fn sq_context_last_error(ctx: *mut Context) /// stored there. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn sq_context_new(domain: *const c_char, - errp: Option<&mut *mut failure::Error>) + errp: Option<&mut *mut ::error::Error>) -> *mut Context { ffi_make_fry_from_errp!(errp); let domain = ffi_param_cstr!(domain).to_string_lossy(); @@ -164,7 +163,7 @@ pub extern "system" fn sq_context_ephemeral(ctx: *const Context) -> uint8_t { /// errors. If `errp` is not `NULL`, the error is stored there. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn sq_config_build(cfg: *mut Config, - errp: Option<&mut *mut failure::Error>) + errp: Option<&mut *mut ::error::Error>) -> *mut Context { ffi_make_fry_from_errp!(errp); let cfg = ffi_param_move!(cfg); diff --git a/ffi/src/error.rs b/ffi/src/error.rs index d9fb2c21..cffb1ba9 100644 --- a/ffi/src/error.rs +++ b/ffi/src/error.rs @@ -7,6 +7,8 @@ extern crate sequoia_openpgp as openpgp; use sequoia_core as core; pub use openpgp::error::Status; +pub(crate) use ::openpgp::error::Error; + trait FromSequoiaError<'a> { fn from_sequoia_error(&'a failure::Error) -> Status; } |