Merge branch 'master' into feat-c-api-wasi-unordered-imports

This commit is contained in:
Ivan Enderlin
2021-02-02 12:17:01 +01:00
18 changed files with 499 additions and 48 deletions

View File

@@ -467,16 +467,19 @@ macro_rules! wasm_declare_own {
#[macro_export]
macro_rules! c_try {
($expr:expr) => {{
($expr:expr; otherwise $return:expr) => {{
let res: Result<_, _> = $expr;
match res {
Ok(val) => val,
Err(err) => {
crate::error::update_last_error(err);
return None;
return $return;
}
}
}};
($expr:expr) => {{
c_try!($expr; otherwise None)
}};
($expr:expr, $e:expr) => {{
let opt: Option<_> = $expr;
c_try!(opt.ok_or_else(|| $e))