fix: Do not duplicate ctx expr in check_call_opt_key!
(cherry picked from commit 86ddc63a573cd08ec19008448ec2fca33a84159e)
This commit is contained in:
parent
35803f4a30
commit
da26721bea
2 changed files with 8 additions and 7 deletions
|
|
@ -107,15 +107,16 @@ pub use check_call;
|
|||
macro_rules! check_call_opt_key {
|
||||
($f:path[$ctx:expr, $($arg:expr),*]) => {
|
||||
{
|
||||
let ret = $f($ctx.ptr(), $($arg,)*);
|
||||
if unsafe { raw::err_code($ctx.ptr()) == raw::NIX_ERR_KEY } {
|
||||
$ctx.clear();
|
||||
let ctx : &mut $crate::context::Context = $ctx;
|
||||
let ret = $f(ctx.ptr(), $($arg,)*);
|
||||
if unsafe { raw::err_code(ctx.ptr()) == raw::NIX_ERR_KEY } {
|
||||
ctx.clear();
|
||||
return Ok(None);
|
||||
}
|
||||
match $ctx.check_err() {
|
||||
match ctx.check_err() {
|
||||
Ok(_) => Ok(Some(ret)),
|
||||
Err(e) => {
|
||||
$ctx.clear();
|
||||
ctx.clear();
|
||||
Err(e)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue