aboutsummaryrefslogtreecommitdiff
path: root/openssl/src/macros.rs
diff options
context:
space:
mode:
authorSteven Fackler <[email protected]>2016-10-17 09:14:33 -0700
committerGitHub <[email protected]>2016-10-17 09:14:33 -0700
commitf6bf022cf214869fc5a4be80617759fe7ee89d8f (patch)
tree0a13df9c28a0a967ba7477979c2c0883aa6ef456 /openssl/src/macros.rs
parentMerge pull request #475 from sfackler/no-enums (diff)
parentFix missing import (diff)
downloadrust-openssl-f6bf022cf214869fc5a4be80617759fe7ee89d8f.tar.xz
rust-openssl-f6bf022cf214869fc5a4be80617759fe7ee89d8f.zip
Merge pull request #476 from sfackler/error-handling
Overhaul error handling plus random APIs
Diffstat (limited to 'openssl/src/macros.rs')
-rw-r--r--openssl/src/macros.rs81
1 files changed, 0 insertions, 81 deletions
diff --git a/openssl/src/macros.rs b/openssl/src/macros.rs
index 31c298fa..85175445 100644
--- a/openssl/src/macros.rs
+++ b/openssl/src/macros.rs
@@ -1,86 +1,5 @@
#![macro_use]
-macro_rules! try_ssl_stream {
- ($e:expr) => (
- match $e {
- Ok(ok) => ok,
- Err(err) => return Err(StreamError(err))
- }
- )
-}
-
-/// Shortcut return with SSL error if something went wrong
-macro_rules! try_ssl_if {
- ($e:expr) => (
- if $e {
- return Err(::error::ErrorStack::get().into())
- }
- )
-}
-
-/// Shortcut return with SSL error if last error result is 0
-/// (default)
-macro_rules! try_ssl{
- ($e:expr) => (try_ssl_if!($e == 0))
-}
-
-/// Shortcut return with SSL if got a null result
-macro_rules! try_ssl_null{
- ($e:expr) => ({
- let t = $e;
- try_ssl_if!(t == ptr::null_mut());
- t
- })
-}
-
-/// Shortcut return with SSL error if last error result is -1
-/// (default for size)
-macro_rules! try_ssl_returns_size{
- ($e:expr) => (
- if $e == -1 {
- return Err(::error::ErrorStack::get().into())
- } else {
- $e
- }
- )
-}
-
-/// Lifts current SSL error code into Result<(), Error>
-/// if expression is true
-/// Lifting is actually a shortcut of the following form:
-///
-/// ```ignore
-/// let _ = try!(something)
-/// Ok(())
-/// ```
-macro_rules! lift_ssl_if{
- ($e:expr) => ( {
- if $e {
- Err(::error::ErrorStack::get().into())
- } else {
- Ok(())
- }
- })
-}
-
-/// Lifts current SSL error code into Result<(), Error>
-/// if SSL returned 0 (default error indication)
-macro_rules! lift_ssl {
- ($e:expr) => (lift_ssl_if!($e == 0))
-}
-
-/// Lifts current SSL error code into Result<(), Error>
-/// if SSL returned -1 (default size error indication)
-macro_rules! lift_ssl_returns_size {
- ($e:expr) => ( {
- if $e == -1 {
- Err(::error::ErrorStack::get().into())
- } else {
- Ok($e)
- }
- })
-}
-
#[cfg(ossl10x)]
macro_rules! CRYPTO_free {
($e:expr) => (::ffi::CRYPTO_free($e))