capi: check api is aligned
This commit is contained in:
parent
403ed5ed13
commit
1fa85d1e4d
2 changed files with 5 additions and 3 deletions
|
@ -194,12 +194,12 @@ impl LibrashaderError {
|
|||
|
||||
macro_rules! assert_non_null {
|
||||
($value:ident) => {
|
||||
if $value.is_null() {
|
||||
if $value.is_null() || !$value.is_aligned() {
|
||||
return $crate::error::LibrashaderError::InvalidParameter(stringify!($value)).export();
|
||||
}
|
||||
};
|
||||
(noexport $value:ident) => {
|
||||
if $value.is_null() {
|
||||
if $value.is_null() || !$value.is_aligned() {
|
||||
return Err($crate::error::LibrashaderError::InvalidParameter(
|
||||
stringify!($value),
|
||||
));
|
||||
|
@ -234,5 +234,6 @@ macro_rules! assert_some_ptr {
|
|||
|
||||
use crate::ctypes::libra_error_t;
|
||||
pub(crate) use assert_non_null;
|
||||
|
||||
// pub(crate) use assert_some;
|
||||
pub(crate) use assert_some_ptr;
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
//! `libra_error_free`.
|
||||
#![allow(non_camel_case_types)]
|
||||
#![feature(try_blocks)]
|
||||
#![feature(pointer_is_aligned)]
|
||||
#![feature(vec_into_raw_parts)]
|
||||
#![deny(unsafe_op_in_unsafe_fn)]
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue