Also remove the now-redundant `bssl_` part of the names of the things inside the module. This should help avoid confusion in the event we create a ring-ffi crate.
31 lines
1.1 KiB
Rust
31 lines
1.1 KiB
Rust
// Copyright 2015 Brian Smith.
|
|
//
|
|
// Permission to use, copy, modify, and/or distribute this software for any
|
|
// purpose with or without fee is hereby granted, provided that the above
|
|
// copyright notice and this permission notice appear in all copies.
|
|
//
|
|
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL WARRANTIES
|
|
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
|
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY
|
|
// SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
|
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
// OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
// CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
|
|
use super::c;
|
|
|
|
pub fn map_result(bssl_result: c::int) -> Result<(), ()> {
|
|
match bssl_result {
|
|
1 => Ok(()),
|
|
_ => Err(())
|
|
}
|
|
}
|
|
|
|
#[cfg(not(feature = "no_heap"))]
|
|
pub fn map_ptr_result<T>(bssl_result: *mut T) -> Result<*mut T, ()> {
|
|
if bssl_result.is_null() {
|
|
return Err(());
|
|
}
|
|
Ok(bssl_result)
|
|
}
|